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
@wong2
wong2 / rrv6.js
Created January 20, 2012 09:46
抢人人v6
object.use("net",function(net){
function f(){
new net.Request({
url:"http://www.renren.com/bulletin/lottery",method:"post",
onSuccess:function(r){
if (parseInt(r.responseText)==1){alert("终于抢到了。。")}
else{console.log("还没...");setTimeout(f,1000)}
},
onError:function(){alert("网络错误,请稍后再试")}
}).send()
@wong2
wong2 / rr_video_comments.js
Created February 18, 2012 06:34
获取人人上某视频分享下的所有评论
function getComments(shareId, ownerId, startCommentId){
var count = 0;
function getComment(commentId){
var data = { shareId: shareId, owner: ownerId, commentId: commentId }
data.md5 = XN.app.share.CommentManger.getOptions("shareUrlMd5");
var xhr = new XN.net.xmlhttp({
url: "http://share.renren.com/share/comment/moreurlcomment",
data: XN.array.toQueryString(data),
@wong2
wong2 / scanner.c
Created March 4, 2012 07:53
编译原理作业
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#define NUM_OF_KEYWORDS 7
#define BUFFER_SIZE 1000
#define TOKEN_VALUE_SIZE 20
typedef struct Token{
@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.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 / 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 / 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 / jump.js
Created October 19, 2015 09:25
自动播放东方时尚驾考视频
// 在 http://dfss.anjia365.com/jpv2/web/personPlan!player.do 页面,console里输入:
setInterval(function() {
if ($('#player').css('display') == 'none') {
getExamById(examArray.slice(-2)[0]);
examCorrectFlag = true;
$('#nextPlayButton').click();
} else {
showNext();
$('.aui_buttons button').click();
@wong2
wong2 / example.py
Created October 23, 2015 07:15
very simple flask-like web framework, taken from http://lucumr.pocoo.org/2010/6/14/opening-the-flask/
from flask import Flask
app = Flask()
@app.route('/')
def index(request):
return 'Hello World'
if __name__ == '__main__':
app.run()
>>> import matplotlib.font_manager
>>> set([f.name for f in matplotlib.font_manager.fontManager.ttflist])