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 concurrent.futures import ThreadPoolExecutor | |
from functools import partial, wraps | |
import time | |
import tornado.ioloop | |
import tornado.web | |
EXECUTOR = ThreadPoolExecutor(max_workers=4) |
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/env python2 | |
#coding:utf-8 | |
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]') |
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
import os,sqlite3 | |
def create_sql(infile,outfile): | |
print infile,outfile | |
outfs = open(outfile,'wb') | |
with open(infile,'rb') as infs: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 | |
import re | |
import urllib | |
import pprint | |
import logging | |
from lxml.html import fromstring,tostring | |
from gevent.pool import Pool | |
pool = Pool(3) |
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/local/bin/python | |
#coding:utf-8 | |
import re | |
import os | |
import sys | |
import syslog | |
from optparse import OptionParser | |
syslog.openlog("nagios_plugin") |
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
# 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 | |
# https://github.com/davidwtbuxton/bottle/commit/ddd712ef252b06ecd0e957f8ac4e37b65ee79cae | |
import bottle | |
subapp = bottle.Bottle() |
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 Crypto.Cipher import AES | |
from Crypto import Random | |
import base64 | |
import hashlib | |
_key = 't_o_u_g_h_radius' | |
class AESCipher: |
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
def sleep(secs): | |
d = Deferred() | |
reactor.callLater(secs, d.callback, None) | |
return d |
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/env python | |
# encoding: UTF-8 | |
"""DoubanServiceBench""" | |
__author__ = "Qiangning Hong <hongqn@gmail.com>" | |
__version__ = "$Revision: 51434 $" | |
__date__ = "$Date: 2010-11-17 17:44:38 +0800 (Wed, 17 Nov 2010) $" | |
import sys |
OlderNewer