I hereby claim:
- I am monsterxx03 on github.
- I am monsterxx03 (https://keybase.io/monsterxx03) on keybase.
- I have a public key ASCvzuVyvGtUBllQW-u5m7Tz47GYN9OZpBPnvFzDZWs5ygo
To claim this, I am signing this object:
#!/usr/bin/python | |
#coding=utf-8 | |
#**************************************************** | |
# Author: XYJ - xyj.asmy@gmail.com | |
# Last modified: 2012-07-02 09:44 | |
# Filename: observer.py | |
# Description: | |
#**************************************************** | |
#coding=utf-8 | |
#!/usr/bin/python | |
import re | |
import json | |
from bs4 import BeautifulSoup | |
with open('t1.txt') as f: | |
doc = f.read() | |
soup = BeautifulSoup(doc) | |
scripts = soup.find_all('script') |
l = ['11', '11', '11', '22', '22', '33'] | |
from collections import Counter | |
c = Counter(l) | |
c.most_comon() | |
>> [('11', 3), ('22', 2), ('33', 1)] |
import socket | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(('127.0.0.1', 8001)) | |
s.listen(2) | |
while 1: | |
conn, addr = s.accept() | |
print 'connected by', addr | |
conn.sendall('response\n') | |
while 1: |
import socket | |
from thread import start_new_thread | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(('127.0.0.1', 8001)) | |
s.listen(2) | |
print 'listening' | |
def clientthread(conn): |
import time | |
import signal | |
class death_penalty_after(object): | |
def __init__(self, timeout): | |
self.timeout = timeout | |
def __enter__(self): | |
# register alarm siganl to handler | |
signal.signal(signal.SIGALRM, self.handle_death_penalty) |
def profile(result_file_name): | |
def wrapper(fn): | |
def inner_wrapper(*args, **kwargs): | |
import cProfile, pstats | |
pr = cProfile.Profile() | |
pr.enable() | |
value = fn(*args, **kwargs) |
# need install dogpile.cache | |
from hashlib import sha1 | |
token_id = "b7e3119430214967ae34695bab783b08" | |
key = sha1("token-" + token_id).hexdigest() | |
c = memcache.Client([“127.0.0.1:11211”]) | |
value = c.get(memcache_key) | |
print value | |
I hereby claim:
To claim this, I am signing this object:
import socket | |
import time | |
host = '127.0.0.1' | |
port = 80 | |
TOTAL_TIME = 0 | |
count = 10 | |