This file contains 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 bottle import route, run | |
@route('/hello') | |
def hello(): | |
return "Hello World!" | |
run(host='localhost', port=8080, debug=True) |
This file contains 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
# sudo apt-get install xclip | |
# sudo pip install xerox begin | |
import time | |
import sys | |
import os | |
import io | |
import xerox | |
import begin |
This file contains 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
Flask, Python 2.7, Single core 271.97 [#/sec] (mean) | |
Flask, Pypy, Single core 547.11 | |
Flask+Gunicorn, Python, 8Core 1363.06 | |
Flask+Gunicorn, Pypy, 8Core 2701.90 | |
Flask+Gunicorn+Tornado, Python, 8Core 1403.88 | |
Flask+Gunicorn+Tornado, Pypy, 8Core 2582.12 | |
Tornado, Python, Single core 839.65 | |
Tornado, Async, Python, Single core 801.19 | |
Tornado, Pypy, Single core 1841.41 | |
Tornado, Async, Pypy, Single core 1734.37 |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
To install pylinkgrammar on Ubuntu | |
sudo apt-get install liblink-grammar4-dev cmake swig | |
pip install pylinkgrammar | |
""" | |
from pylinkgrammar.linkgrammar import Parser |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Test MBSP parsing | |
Help on clips.MBSP | |
http://www.clips.ua.ac.be/pages/MBSP | |
""" | |
import MBSP | |
from time import time |
This file contains 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
# show log in online and color | |
# Usage: tig | |
sudo apt-get install tig | |
# git extras | |
# Usage: see https://github.com/visionmedia/git-extras | |
(cd /tmp && git clone --depth 1 https://github.com/visionmedia/git-extras.git && cd git-extras && sudo make install) | |
# full commit history with diff of a file | |
# Usage: git history foo.py |
This file contains 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/sh | |
echo "data:image/png;base64,`base64 $1`" |
This file contains 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
$ cat /proc/cpuinfo | grep "model name" | uniq | |
model name : Intel(R) Core(TM)2 Quad CPU Q8400 @ 2.66GHz | |
$ uname -a | |
Linux Q8400 3.5.0-37-generic #58-Ubuntu SMP Mon Jul 8 22:07:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux | |
$ python --version | |
Python 2.7.3 | |
$ python -m timeit '"-".join(str(n) for n in range(100))' | |
10000 loops, best of 3: 24.4 usec per loop |
This file contains 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/python | |
import time | |
# sudo apt-get install python-daemon | |
from daemon import runner | |
class App(): | |
def __init__(self): | |
self.stdin_path = '/dev/null' | |
self.stdout_path = '/dev/tty' |
This file contains 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 text.blob import TextBlob | |
text = ''' | |
The titular threat of The Blob has always struck me as the ultimate movie | |
monster: an insatiably hungry, amoeba-like mass able to penetrate | |
virtually any safeguard, capable of--as a doomed doctor chillingly | |
describes it--"assimilating flesh on contact. | |
Snide comparisons to gelatin be damned, it's a concept with the most | |
devastating of potential consequences, not unlike the grey goo scenario | |
proposed by technological theorists fearful of |