Skip to content

Instantly share code, notes, and snippets.

View axiaoxin's full-sized avatar
🌙
不忙着圆缺 春天不走远

axiaoxin axiaoxin

🌙
不忙着圆缺 春天不走远
View GitHub Profile
下载链接 http://www.charlesproxy.com/download/
Registered name:
Rajax Network Technology Co., Ltd.
License key:
2dcd56e6f3cbacaa7e
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]
#-*- 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)
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)
@axiaoxin
axiaoxin / download_teacher_files.py
Last active August 29, 2015 14:19
download_teacher_files.py
# !/usr/bin/env python
# -*- coding:utf-8 -*-
import urllib2
import cookielib
import re
import urllib
import os
import Queue
import threading
@axiaoxin
axiaoxin / rand_cn_char.py
Last active August 29, 2015 14:19
rand_cn_char.py
#-*- 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":
@axiaoxin
axiaoxin / case_insensitive_dict.py
Last active August 29, 2015 14:19
case_insensitive_dict.py
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()
@axiaoxin
axiaoxin / clear_windows_dirs.py
Last active August 29, 2015 14:19
clear windows dirs
#! /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)
@axiaoxin
axiaoxin / gui.py
Last active August 29, 2015 14:19
验证教师课件密码
# -*- coding:utf-8 -*-
'''
Created on 2011-10-3
@author: AshIn
'''
from Tkinter import *
import ScrolledText
import re
import threading
import time
@axiaoxin
axiaoxin / spider.py
Created April 22, 2015 09:26
spider demo
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
import urllib2
import sqlite3
from BeautifulSoup import BeautifulSoup
import sys
import time
import getopt