$ brew install python --framework
$ mkdir ~/Library/Frameworks/
$ cd ~/Library/Frameworks/
$ ln -s /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework .
$ brew install -vd ./vim.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Cassandra on EC2 using Apache Whirr trunk (18 January 2012) | |
| # Clone the repo from the Apache servers | |
| git clone git://git.apache.org/whirr.git | |
| cd whirr | |
| # build binary artefacts on your machine | |
| mvn clean install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "flag" | |
| "io" | |
| "log" | |
| "net" | |
| "runtime" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A solution to the Instagram Engineering Challenge (http://goo.gl/B92t0) | |
| package main | |
| import ( | |
| "fmt" | |
| "image" | |
| "image/draw" | |
| "image/jpeg" | |
| "image/png" | |
| "io" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Pyrocfile - Simple Python impementation of Procfile manager | |
| # Written by Chris Testa (http://testa.co/) in 2011 | |
| # Released in the Public Domain | |
| import argparse, logging, os.path, random, re, select, signal, subprocess | |
| def _new_logger(name, color=None): | |
| logger = logging.getLogger(name) | |
| hdlr = logging.StreamHandler() | |
| color, end_color = '\033[9%dm' % (color or random.randint(1, 6)), '\033[0m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from os import listdir, system | |
| ip = raw_input("Destination server IP: ") | |
| for dir in listdir('/var/cpanel/users'): | |
| system('/scripts/pkgacct --skiphomedir --nocompress %s /home cpmove' % dir) | |
| system('scp /home/cpmove-*.tar root@%s:/home/' % ip) | |
| system('rsync -avHle ssh /home/%s/ root@%s:/home/%s/ --progress' % (dir, ip, dir)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度 | |
| # 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装 | |
| # 做这个起什么作用? | |
| # rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。 | |
| # 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外 | |
| proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m | |
| inactive=24h max_size=1g; | |
| server { | |
| listen 80; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :+1: | |
| :-1: | |
| :airplane: | |
| :art: | |
| :bear: | |
| :beer: | |
| :bike: | |
| :bomb: | |
| :book: | |
| :bulb: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Finding the total size of your biggest tables | |
| SELECT nspname || '.' || relname AS "relation", | |
| pg_size_pretty(pg_relation_size(C.oid)) AS "size" | |
| FROM pg_class C | |
| LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
| WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
| ORDER BY pg_relation_size(C.oid) DESC | |
| LIMIT 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |