Skip to content

Instantly share code, notes, and snippets.

jamiesun jamiesun

Block or report user

Report or block jamiesun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
import tornado.ioloop
import tornado.web
EXECUTOR = ThreadPoolExecutor(max_workers=4)
#!/usr/bin/env python2
import logging
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
from tornado.tcpserver import TCPServer
logging.basicConfig(level=logging.INFO, format='%(levelname)s - - %(asctime)s %(message)s', datefmt='[%d/%b/%Y %H:%M:%S]')
import os,sqlite3
def create_sql(infile,outfile):
print infile,outfile
outfs = open(outfile,'wb')
with open(infile,'rb') as infs:
View python_comprehension.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import re
import urllib
import pprint
import logging
from lxml.html import fromstring,tostring
from gevent.pool import Pool
pool = Pool(3)
jamiesun / check_temp
Created Jun 4, 2014
nagios coretemp check
View check_temp
import re
import os
import sys
import syslog
from optparse import OptionParser
View gist:017ebd67fd1528b531fd
# Demonstration of inspecting all the routes, including those on sub-apps,
# from the default app instance.
# This should be run directly to print a list of route prefixes and the rules.
# Tested with Python 2.7 and Bottle-dev. Patch here
import bottle
subapp = bottle.Bottle()
View AESCipher
from Crypto.Cipher import AES
from Crypto import Random
import base64
import hashlib
_key = 't_o_u_g_h_radius'
class AESCipher:
jamiesun / sh
Created Feb 24, 2015
python color shell
View sh
#!/usr/bin/env python
import sys
import os
import subprocess
import time
class ToughError(Exception):
def __init__(self, message):
self.message = message
def sleep(secs):
d = Deferred()
reactor.callLater(secs, d.callback, None)
return d
You can’t perform that action at this time.