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 / 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 / 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 / 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 / wong2.js
Created January 17, 2012 06:09
备份。。
/**
* 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
#-*-coding:utf-8-*-
from cmd import Cmd
import os
import atexit
from user import User
import getpwd
import sys
# ls
@wong2
wong2 / sleepsort.py
Created June 18, 2011 05:43
SleepSort-Python using threading.Timer
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()