This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gc(){ | |
git add . && git commit -am "$@" | |
} | |
alias "pg=ping 8.8.8.8" | |
gcp(){ | |
git add . | |
git commit -am "$@" && git push | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
As a client can use the next html page: | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
window.addEventListener("load", function() { | |
// create websocket instance | |
var mySocket = new WebSocket("ws://localhost:8080/ws"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Simple Flask application to demonstrate the Google Speech API usage. | |
Install the requirements first: | |
`pip install SpeechRecognition flask` | |
Then just run this file, go to http://127.0.0.1:5000/ | |
and upload an audio (or may be even video) file there, using the html form. | |
(I've tested it with a .wav file only - relying on Google here). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
events { | |
worker_connections 768; | |
# multi_accept on; | |
} | |
http { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# chkconfig: 345 96 4 | |
NAME=uwsgi | |
DESC=uwsgi | |
PIDFILE=/home/aviasales/.uwsgi.pid | |
USER=aviasales | |
# Source function library. | |
. /etc/init.d/functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# parent.py | |
import sys | |
from subprocess import Popen, PIPE | |
with Popen([sys.executable, "child.py"], stdout=PIPE, stdin=PIPE, bufsize=1, | |
universal_newlines=True) as p: | |
for line in sys.stdin: | |
line = line.rstrip('\n') | |
print(line, file=p.stdin, flush=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from queue import Queue | |
import threading | |
class GeneratedQueue(Queue): | |
""" | |
usage: | |
for item in q.each(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BulletProof(object): | |
def __getattribute__(self, name): | |
if name == '__class__': | |
return super(BulletProof, self).__getattribute__(name) | |
return BulletProof() | |
def __str__(self): | |
return '' | |
b = BulletProof() | |
print(b.asdas.sdgfd.gd.dfg.dfg.gdfhgftg.h.dfgfgh) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
$(cd pages && python -m SimpleHTTPServer ) & | |
while true; do | |
change=$(inotifywait -r -e close_write,moved_to,create templates/*) | |
change=${change#./templates/* } | |
(./render_test_airline.py && echo -e "\033[1;32mtemplate recompiled\033[0m") || echo -e "\033[1;31merror!\033[0m" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>CodePen - Modern HTML5 Lightbox in 12 Lines of JavaScript</title> | |
<style> | |
dialog { | |
position: fixed; | |
left: 50%; |
NewerOlder