Skip to content

Instantly share code, notes, and snippets.

@Chairo
Chairo / requests.py
Created March 27, 2012 12:56
requests mutil-threading
# -*- coding:utf-8 -*-
import requests
from time import sleep
from threading import Thread
UPDATE_INTERVAL = 0.01
class URLThread(Thread):
def __init__(self, url, timeout=10, allow_redirects=True):
super(URLThread, self).__init__()
@Chairo
Chairo / backup.sh
Created March 30, 2012 09:27
自动备份脚本
#!/bin/bash
#Funciont: Backup website and mysql database
#Author: licess
#Website: http://lnmp.org
#IMPORTANT!!!Please Setting the following Values!
bak_dir=/home/backup
if [ -d $bak_dir ]; then
echo 'begin'
@Chairo
Chairo / Copyer.py
Created April 1, 2012 16:12
扒皮工具
# -*- coding:utf-8 -*-
import requests, os, re, sys, time
from time import sleep
from threading import Thread
reload(sys)
sys.setdefaultencoding('utf8')
UPDATE_INTERVAL = 0.01
@Chairo
Chairo / signature
Created April 27, 2012 08:25
hostloc 签名
[table=60%][tr][td][url=http://k2.au92.com/][color=#0000ff][u]Web Proxy[/u][/color][/url]
[color=#008000]广告位[/color] [align=right][b]Google提供[/b][/align]
[/td][/tr][/table]
@Chairo
Chairo / nginx-proxy.sh
Created May 3, 2012 13:13
nginx-proxy.sh
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install lnmp"
exit 1
fi
@Chairo
Chairo / nginx_proxy.conf
Created May 3, 2012 13:20
nginx_proxy.conf
user www www;
worker_processes 1;
error_log /home/wwwlogs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
@Chairo
Chairo / xiami_decode.py
Created May 11, 2012 04:12 — forked from dndx/xiami_decode.py
Xiami URL Decoder
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
@Chairo
Chairo / xiami_decode.js
Created May 11, 2012 04:13 — forked from fanzeyi/xiami_decode.js
Xiami URL Decoder
function decode(loca) {
var result = [], url = "";
var line, rows, extra;
loca = loca.trim();
if(loca === "") {
return "";
}
line = Number(loca[0]);
rows = Math.floor((loca.length - 1) / line);
extra = (loca.length - 1) % line;
@Chairo
Chairo / gist:2849927
Created June 1, 2012 07:29 — forked from zythum/gist:2848881
google收录的敏感词
@Chairo
Chairo / wudongqiankun.py
Created July 12, 2012 09:48
武动乾坤小说采集脚本
# -*- coding:utf-8 -*-
import sys, database, feedparser
reload(sys)
sys.setdefaultencoding('utf-8')
db = database.Connection(host='127.0.0.1', database='wudongqiankun', user='root', password='password')
class Dict():
def __init__(self, d):