Skip to content

Instantly share code, notes, and snippets.

@ftao
ftao / install-fabric-on-windows.rst
Created March 29, 2012 06:33
install fabric on windows

If you need to install fabric on a windows machine without a compiler . This gist may help (We are assuming your are using python27 , search for corresponding packages if you are not )

Install dependences

Install some dependence using pre-compiled package

Win 32

@ftao
ftao / download_video.sh
Created March 18, 2012 03:27
download pycon2012 videos
#!/bin/sh
wget https://github.com/rg3/youtube-dl/zipball/master -O youtube-dl.zip
unzip youtube-dl.zip
cd rg3-youtube-dl-ceba827/
python youtube-dl --batch-file ../pycon2012_video_urls.txt
# python ep2011_video.py | tee ep2011_video.txt
import httplib2
import urlparse
from BeautifulSoup import BeautifulSoup
BASE_URL = 'http://ep2011.europython.eu/'
SCHEDULE_URL = 'http://ep2011.europython.eu/p3/schedule/ep2011/'
headers = {
@ftao
ftao / install_pytho27.sh
Created July 7, 2011 10:00
install python 2.7 on debian 6
#!/bin/sh
mkdir ~/down/
cd ~/down/
sudo apt-get install build-essential
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzf Python-2.7.2.tgz
cd Python-2.7.2
sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev
sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev
sudo apt-get install libssl-dev libdb-dev
@ftao
ftao / cn_cut.py
Created April 6, 2011 13:18
根据新浪微博的规则截断 的 Python 代码片段
def cn_cut(status, length):
l = 0
end = len(status)
for i,c in enumerate(status):
if ord(c) <= 0xff:
l += 1
else:
l += 2
if l > length * 2:
end = i
@ftao
ftao / gist:833555
Created February 18, 2011 11:22 — forked from anonymous/gist:156623
"""
This fabric file makes setting up and deploying a django application much
easier, but it does make a few assumptions. Namely that you're using Git,
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have
Django installed on your local machine and SSH installed on both the local
machine and any servers you want to deploy to.
_note that I've used the name project_name throughout this example. Replace
this with whatever your project is called._