Skip to content

Instantly share code, notes, and snippets.

View masdude's full-sized avatar

masdude

  • China
View GitHub Profile
@mrluanma
mrluanma / requirements.txt
Created September 4, 2012 14:40
Python 登录新浪微博(requests 真的比 urllib2 强了 2^^32 倍 pip install requests)
requests==2.4.3
rsa==3.1.4
@fxsjy
fxsjy / gist:3550053
Created August 31, 2012 08:00
Bakup Weibo to Disk
package main
import (
"net/http"
"net/url"
"log"
"io/ioutil"
"regexp"
"fmt"
//"net/http/httputil"
def quicksel(l,k):
if len(l) <k:
raise ValueError
else:
pivot=l.pop()
lg=filter(lambda x:x>pivot,l)
ll=filter(lambda x:x<=pivot,l)
if len(lg)>=k:
return quicksel(lg,k)
elif len(lg)+1==k:
@justinfay
justinfay / redisbucket.py
Created August 20, 2012 13:01
redis token bucket
import redis
from redis import WatchError
import time
RATE = 0.1
DEFAULT = 100
TIMEOUT = 60 * 60
DEBUG = False
@dongyuwei
dongyuwei / weibo_wap.js
Created August 14, 2012 07:45
自动登陆新浪微博移动版( http://m.weibo.cn ) 发微博
var http = require('http');
var qs = require('querystring');
function parse_response(res, callback) {
var list = [];
res.on('data', function(chunk) {
list.push(chunk);
});
res.on('end', function() {
callback(Buffer.concat(list).toString());
@mrluanma
mrluanma / gist:3328049
Created August 12, 2012 00:10
分分钟在 windows 上配好一个 Common Lisp 环境。
## ccl + quicklisp + SLIME,假设你一直用的 Emacs
mkdir c:\bin
cd c:\bin
curl -O ftp://ftp.clozure.com/pub/release/1.8/ccl-1.8-windowsx86.zip
curl -O http://beta.quicklisp.org/quicklisp.lisp
7z x ccl-1.8-windowsx86.zip ccl
ccl\wx86cl -l quicklisp.lisp
@ipconfiger
ipconfiger / baestore.py
Created August 8, 2012 16:03
BAE中使用云存储的简单wrapper
#coding=utf8
import pybcs
import logging
pybcs.init_logging(logging.INFO)
AK = '' #请改为你的AK
SK = '' #请改为你的SK
BUCKET='myimage1'
@fxsjy
fxsjy / gist:3244607
Created August 3, 2012 05:16
Simple Memcached server in Javascript with 100 lines of code
/* Simple Memcached in Javascript
* @Author: Sun, Junyi
* @Email: ccnusjy@gmail.com
* @Date: 2012-8-3
*/
var net = require('net');
var store = {}
function handle_header(header,crlf_len){
var tup = header.split(" ")
@jkp
jkp / websocketserver.py
Created July 18, 2012 13:28
A simple WebSockets server with no dependencies
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@onlytiancai
onlytiancai / wawammseg.py
Created June 30, 2012 08:44
写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码
# -*- coding:utf-8 -*-
'写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码'
'搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5'
import string
__dict = {}
def load_dict(dict_file='words.dic'):
'加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典'