Skip to content

Instantly share code, notes, and snippets.

View wong2's full-sized avatar
🍃
Waiting for autumn

wong2 wong2

🍃
Waiting for autumn
View GitHub Profile
Sizzle('#active_2012_module li strong a').map(function(a){
var name = a.innerHTML,
pid = /\.com\/(\d+)\?/.exec(a.href)[1];
return name + ': ' + pid;
}).join('\n');
小黄鸡:601621937
小黄鸭:601626316
小黄猪:601626670
小黄鹅:601626463
@wong2
wong2 / README.md
Created January 2, 2013 09:44
模拟登录人人(新)

人人的登录改版后,采用RSA加密后传输密码,该项目用于解决这种情况下人人的模拟登录

使用前先 pip install requests

@wong2
wong2 / simsimi.py
Last active December 10, 2015 08:08
小黄鸡
#-*-coding:utf-8-*-
import requests
import cookielib
class SimSimi:
def __init__(self):
self.session = requests.Session()
self.session.get('http://www.simsimi.com/talk.htm')
@wong2
wong2 / hg-branch.md
Created December 17, 2012 04:14
hg branch
hg branch fixbug
hg commit -m 'new branch'

fix bug...commit...

hg update default

code...commit...

hg update fixbug

@wong2
wong2 / watch.js
Created December 5, 2012 07:30
watchdog example
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class ChangeHandler(FileSystemEventHandler):
def on_modified(self, event):
print event.event_type, event.src_path
if __name__ == "__main__":
event_handler = ChangeHandler()
@wong2
wong2 / example.go
Created October 5, 2012 08:01
Levenshtein Distance Algorithm
package main
import (
"fmt"
"levenshtein"
)
func main() {
r1 := levenshtein.GetDistance("今天的话", "明天再说")
r2 := levenshtein.GetSimilarity("今天天气不错, hello world", "今天天气不错呢, bye bye world")
@wong2
wong2 / pinyin.txt
Created June 17, 2012 15:24
汉字拼音表
bɑ bo bɑi bei bɑo bɑn ben bɑnɡ benɡ bi bie biao biɑn bin binɡ bu
pɑ po pɑi pei pɑo pou pɑn pen pɑnɡ penɡ pi pie piao piɑn pin pinɡ pu
mɑ mo mɑi mei mɑo mou mɑn men mɑnɡ menɡ mi mie miao miu miɑn min minɡ mu
fɑ fo me fei fou fɑn fen fɑnɡ fenɡ fu
dɑ de dɑi dei dɑo dou dɑn den dɑnɡ denɡ donɡ di dia die diao diu diɑn dinɡ du duo dui duɑn dun
tɑ te tɑi tei tɑo tou tɑn tɑnɡ tenɡ tonɡ ti tie tiao tiɑn tinɡ tu tuo tui tuɑn tun
nɑ ne nɑi nei nɑo nou nɑn nen nɑnɡ nenɡ nonɡ ni nie niao niu niɑn nin niɑnɡ ninɡ nu nuo nuɑn nü nüe
lɑ le lɑi lei lɑo lou lɑn lɑnɡ lenɡ lonɡ li lia lie liao liu liɑn lin liɑnɡ linɡ lu luo luɑn lun lü lüe
ɡɑ ɡe ɡɑi ɡei ɡɑo ɡou ɡɑn ɡen ɡɑnɡ ɡenɡ ɡonɡ ɡu ɡuɑ guo ɡuɑi ɡui ɡuɑn ɡun ɡuɑnɡ
kɑ ke kɑi kɑo kou kɑn ken kɑnɡ kenɡ konɡ ku kuɑ kuo kuɑi kui kuɑn kun kuɑnɡ
@wong2
wong2 / google_black_list.js
Created May 31, 2012 18:31
Google Chinese blacklist
var a = [[1492], [6656], [8759], [63166], [9287], [4369], [8811], [7556], [6262], [14399], [64357], [64353], [10546], [6450], [63794], [61408], [60467, 60463, 30321, 30325, 5103, 9471, 8510, 30243, 5103, 9471, 8510, 30321, 30325, 60467, 60463], [63413, 878, 10006, 64901], [57367, 10006, 64901, 14548, 14505], [10006, 64901, 30321, 30325, 6877, 9480, 30243, 6877, 9480, 30321, 30325, 10006, 64901], [57367, 10006, 64901, 30321, 30325, 14624, 61401, 30243, 14624, 61401, 30321, 30325, 57367, 10006, 64901], [62995, 4015, 62638, 64946, 30321, 30325, 3339, 7703,
30243, 3339, 7703, 30321, 30325, 62995, 4015, 62638, 64946], [10035, 9470, 8711, 30321, 30325, 3339, 7703, 30243, 3339, 7703, 30321, 30325, 10035, 9470, 8711], [62427, 643, 643], [6952, 14674, 10728], [10851, 10827, 14674, 10728], [30263, 30266, 30246, 30248, 30256, 30256, 30267], [30257, 30266, 30262, 30259, 30321, 30325, 30248, 30256, 30256, 30267, 30243, 30248, 30256, 30256, 30267, 30321, 30325, 30257, 30266, 30262, 30259], [12150, 2272, 11
@wong2
wong2 / weibo_token.py
Created April 25, 2012 12:29
get weibo access token
from config import APP_SECRET, APP_KEY
from weibopy.auth import OAuthHandler
CALLBACK = ""
auth = OAuthHandler(APP_KEY, APP_SECRET, CALLBACK)
url = auth.get_authorization_url()
print "open this in the browser: " + url
code = raw_input("input the code: ")
@wong2
wong2 / pinyin_seg.py
Created March 4, 2012 08:15
以前写的一个简单拼音分词程序。"tianqibucuo" -> "tian qi bu cuo"
#-*-coding:utf-8-*-
def seg(pinyin):
sm = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'w', 'x', 'y', 'z', 'sh', 'zh', 'ch']
ymd = {'a': {'i':None, 'o':None, 'n': {'g': None}},
'e': {'i':None, 'r':None, 'n': {'g': None}},
'i': {'e':None, 'a':{'n':{'g':None}, 'o':None}, 'u':None, 'o':{'n':{'g':None}}, 'n':{'g':None}},
'o': {'u':None, 'n':{'g':None}},
'u': {'a':{'i':None, 'n':{'g':None}}, 'e':None, 'i':None, 'o':None}
}