Skip to content

Instantly share code, notes, and snippets.

View Kingson's full-sized avatar
🎯
Focusing

Kingson Zhou Kingson

🎯
Focusing
  • ButtonSoftware
  • China
View GitHub Profile
#!/usr/bin/env python
# encoding: utf-8
"""
Usage:
fab deploy:appname
"""
from fabric.api import env, run, cd, local, put
env.hosts = ['myserver.com']
env.user = 'eric'
@Arthraim
Arthraim / bottle_example.py
Created May 27, 2011 04:27
a python web framework bottle's example
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@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 / 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
@greatghoul
greatghoul / 265g_pics.py
Created September 26, 2012 17:22
265g.com 美图下载
#-*- coding: utf-8 -*-
import urllib, re, os, argparse
RE_NEXT_URL = ur'<a href=\"(?!javascript\:)([^\"]*?)">下一页<\/a>'
RE_PICTURE = ur'<p\s+(?:align=\"center\")>\s*<img.*?src=\"(.*?)\".*?\/?>'
RE_ARCTITLE = ur'var arctitle=\'(.*?)\';'
def get_html(url):
try:
return urllib.urlopen(url).read().decode('gbk')
@onlytiancai
onlytiancai / python_infrastructure.md
Created October 12, 2012 08:55
python 基础设施讨论贴

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

@Kingson
Kingson / wblogin.py
Created January 6, 2013 08:21 — forked from mrluanma/requirements.txt
自动登录新浪微博脚本。
import re
import json
import urllib
import base64
import hashlib
import requests
import OS
WBCLIENT = 'ssologin.js(v.1.3.18)'
@romyilano
romyilano / customheader+footer.m
Created February 26, 2013 02:56
custom header and footer to a UITableView (programmatically) nice! from apress.com pro ios tableviews for iphone
@Kingson
Kingson / Douban_movie_query.py
Last active December 14, 2015 16:29
豆瓣电影查询助手V1.0 #实现通过电影ID来查询电影信息,返回电影Title和Summary。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json
@Kingson
Kingson / Douban_movie_query.py
Last active October 12, 2016 15:52
豆瓣电影查询助手V2.0 #1.0中通过电影ID来查询电影信息,显然让用户蛋很疼,使用电影名称才是王道,本版本就是使用电影名称,调用豆瓣Movie Search接口和Subject接口,拿到电影海报,Title,Description等信息,以图文信息返给微信用户。 #但,本版本直接返回查询出的第一条数据,有时会不准确,显示的结果不是自己所要查询的,这个问题争取在下一个版本中解决。
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json