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
| 下载链接 http://www.charlesproxy.com/download/ | |
| Registered name: | |
| Rajax Network Technology Co., Ltd. | |
| License key: | |
| 2dcd56e6f3cbacaa7e |
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
| flatten = lambda lst: reduce(lambda l, i: l + flatten(i) if isinstance(i, (list, tuple)) else l + [i], lst, []) | |
| print flatten([2, [2, [4, 5, [7], [2, [6, 2, 6, [6], 4]], 6]]]) | |
| # [2, 2, 4, 5, 7, 2, 6, 2, 6, 6, 4, 6] |
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 urllib2 | |
| import re | |
| def get_lrc(name, singer): | |
| xml_url = 'http://box.zhangmen.baidu.com/x?op=12&count=1&title=%s$$%s$$$$'%(name.encode('utf-8'), singer.encode('utf-8')) | |
| xml_str = urllib2.urlopen(xml_url).read() | |
| lrcid_pattern = re.compile(r'<lrcid>(.+?)</lrcid>') | |
| lrcid = int(re.search(lrcid_pattern, xml_str).group(1)) | |
| lrc_url = "http://box.zhangmen.baidu.com/bdlrc/%d/%d.lrc"%(lrcid//100, lrcid) |
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 stepic | |
| from PIL import Image | |
| import sys | |
| useage = 'useage:\nencode: python hideinfo.py IMG INFO OUTPUT\ndecode: python hideinfo.py IMG' | |
| def encode_img(img, info, output): | |
| img = Image.open(img) | |
| d = open(info) |
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 urllib2 | |
| import cookielib | |
| import re | |
| import urllib | |
| import os | |
| import Queue | |
| 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
| #-*- coding:utf-8 -*- | |
| __author__ = 'ashin' | |
| import random | |
| def rand_cn_char(length=1, encode="gb2312"): | |
| '''get the random chinese characters''' | |
| chars = [] | |
| try: | |
| if encode=="gb2312": |
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
| class case_insensitive_dict(dict): | |
| def _lower_keys(self): | |
| return map(str.lower, self.keys()) | |
| def __getitem__(self, key): | |
| return self.items()[self._lower_keys().index(key.lower())][1] | |
| def __contains__(self, key): | |
| return key.lower() in self._lower_keys() |
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 time | |
| def clear(path): | |
| for file_or_path in os.listdir(path): | |
| file_name = os.path.join(path, file_or_path) |
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 -*- | |
| ''' | |
| Created on 2011-10-3 | |
| @author: AshIn | |
| ''' | |
| from Tkinter import * | |
| import ScrolledText | |
| import re | |
| import threading | |
| import time |
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 re | |
| import urllib2 | |
| import sqlite3 | |
| from BeautifulSoup import BeautifulSoup | |
| import sys | |
| import time | |
| import getopt |