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
# 1. Install the dependencies | |
yum install gcc-c++ libsigc++20-devel | |
# 2. Install libTorrent | |
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz | |
./configure --prefix=$HOME/local && make && make install | |
# 3. Install the client | |
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz | |
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig |
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 geventwebsocket.handler import WebSocketHandler | |
from gevent.pywsgi import WSGIServer | |
from flask import Flask, request, render_template | |
app = Flask(__name__) | |
app.debug = True | |
@app.route('/') | |
def index(): | |
return render_template('index.html') |
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
#coding: utf-8 | |
from datetime import datetime | |
import time | |
# ============================================================================== | |
# Test yield | |
# ============================================================================== | |
def test_yield(): | |
for i in range(4): |
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
import cPickle | |
__all__ = ["memoize"] | |
def memoize(function, limit=None): | |
if isinstance(function, int): | |
def memoize_wrapper(f): | |
return memoize(f, function) | |
return memoize_wrapper |
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
import os | |
app = '{YOUR-WSGI-APPLICATION}' | |
# Sample Gunicorn configuration file. | |
# | |
# Server socket | |
# | |
# bind - The socket to bind. |
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 | |
#coding: utf-8 | |
import os | |
import imp | |
import time | |
import signal | |
import argparse | |
import commands |
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 | |
#coding: utf-8 | |
# ============================================================================== | |
# python -m doctest -v test_rsub.py | |
# ============================================================================== | |
class Left1(int): | |
""" |
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
############################################################ | |
# 1. Install debian 7 by live CD | |
############################################################ | |
# grub> ls / | |
# grub> linux /vmlinuz | |
# grub> initrd /initrd.gz | |
# grub> boot | |
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
def spawnDaemon(func): | |
# do the UNIX double-fork magic, see Stevens' "Advanced | |
# Programming in the UNIX Environment" for details (ISBN 0201563177) | |
try: | |
pid = os.fork() | |
if pid > 0: | |
# parent process, return and keep running | |
return | |
except OSError, e: | |
print >>sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror) |
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
#coding: utf-8 | |
import os | |
import time | |
import signal | |
# from datetime import datetime | |
from multiprocessing import Process, Queue | |
import subprocess | |
import threading |