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: utf8 | |
import urllib | |
class HTTPSQS: | |
def __init__(self, host='127.0.0.1', port=1218, charset=None): | |
self.host = host | |
self.port = port | |
self.charset = charset |
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 lru | |
import lrucache | |
import pylru | |
import random | |
import sys | |
size = int(sys.argv[1]) | |
data = [] | |
range_ = int(sys.argv[2]) | |
for i in xrange(int(sys.argv[3])): |
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 mb_code(string, coding="utf-8"): | |
if isinstance(string, unicode): | |
return string.encode(coding) | |
for c in ('utf-8', 'gb2312', 'gbk', 'gb18030', 'big5'): | |
try: | |
return string.decode(c).encode(coding) | |
except: pass | |
return string |
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 setcookie2cookie(setcookie): | |
cookies = setcookie.split("\n") | |
result = [] | |
for ck in cookies: | |
frags = ck.split(";") | |
i = frags[0].index("=") | |
name = frags[0][:i] | |
value = frags[0][i+1:] | |
#name = name.replace("+", " ") | |
if name.strip(): |
NewerOlder