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
\#* | |
*~ | |
*.swp | |
*.py[oc] | |
*.bin | |
flymake_* |
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 glob | |
import logging | |
import logging.handlers | |
LOG_FILENAME = 'logging_rotatingfile_example.out' | |
# Set up a specific logger with our desired output level | |
my_logger = logging.getLogger('MyLogger') | |
my_logger.setLevel(logging.DEBUG) |
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 |
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
############################################################ | |
# 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
#!/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
#!/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
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
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
#coding: utf-8 | |
from datetime import datetime | |
import time | |
# ============================================================================== | |
# Test yield | |
# ============================================================================== | |
def test_yield(): | |
for i in range(4): |