Skip to content

Instantly share code, notes, and snippets.

🍃
Waiting for autumn

Wang Dàpéng wong2

🍃
Waiting for autumn
Block or report user

Report or block wong2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wong2
wong2 / sleepsort.py
Created Jun 18, 2011
SleepSort-Python using threading.Timer
View sleepsort.py
from __future__ import print_function
from threading import Timer
l = [8, 2, 4, 6, 7, 1]
for n in l:
Timer(n, lambda x: print(x), [n]).start()
View gist:1318308
#-*-coding:utf-8-*-
from cmd import Cmd
import os
import atexit
from user import User
import getpwd
import sys
# ls
@wong2
wong2 / wong2.js
Created Jan 17, 2012
备份。。
View wong2.js
/**
* Copyright 2011 wong2 <wonderfuly@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@wong2
wong2 / rrv6.js
Created Jan 20, 2012
抢人人v6
View rrv6.js
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 Feb 18, 2012
获取人人上某视频分享下的所有评论
View rr_video_comments.js
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 Mar 4, 2012
编译原理作业
View scanner.c
#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 / pinyin_seg.py
Created Mar 4, 2012
以前写的一个简单拼音分词程序。"tianqibucuo" -> "tian qi bu cuo"
View pinyin_seg.py
#-*-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}
}
@wong2
wong2 / weibo_token.py
Created Apr 25, 2012
get weibo access token
View weibo_token.py
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 / google_black_list.js
Created May 31, 2012
Google Chinese blacklist
View google_black_list.js
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 / pinyin.txt
Created Jun 17, 2012
汉字拼音表
View pinyin.txt
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ɡ
You can’t perform that action at this time.