As configured in my dotfiles.
start new:
tmux
start new with session name:
| <?xml version="1.0" encoding="UTF-8"?> | |
| <scheme name="Solarized Dark" version="1" parent_scheme="Default"> | |
| <option name="LINE_SPACING" value="1.0" /> | |
| <option name="EDITOR_FONT_SIZE" value="14" /> | |
| <option name="EDITOR_FONT_NAME" value="Consolas" /> | |
| <colors> | |
| <option name="ADDED_LINES_COLOR" value="" /> | |
| <option name="ANNOTATIONS_COLOR" value="2b36" /> | |
| <option name="ANNOTATIONS_MERGED_COLOR" value="" /> | |
| <option name="CARET_COLOR" value="dc322f" /> | 
| import datetime | |
| from django.conf import settings | |
| from django.contrib.auth import logout | |
| from django.contrib.auth.models import User | |
| from django.contrib.sessions.models import Session | |
| from django.http import HttpRequest | |
| from django.utils.importlib import import_module | 
| acl manager proto cache_object | |
| acl localhost src 127.0.0.1/32 | |
| acl localhost src ::1/128 | |
| acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 | |
| acl to_localhost dst ::1/128 | |
| acl localnet src 10.0.0.0/8 | |
| acl localnet src 172.16.0.0/12 | |
| acl localnet src 192.168.0.0/16 | |
| acl localnet src fc00::/7 | |
| acl localnet src fe80::/10 | 
| #!/usr/bin/env python | |
| # -*- coding: utf8 -*- | |
| # author: amoblin <[email protected]> | |
| import sys, re, urllib2, os, urllib | |
| beauty_url = "http://huaban.com/favorite/beauty/" | |
| #beauty_url = "http://huaban.com/" | |
| pin_re = '<a href="/pins/(.+?)/"' | 
As configured in my dotfiles.
start new:
tmux
start new with session name:
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import json | |
| import os | |
| import time | |
| import requests | |
| from PIL import Image | |
| from StringIO import StringIO | |
| from requests.exceptions import ConnectionError | |
| def go(query, path): | |
| """Download full size images from Google image search. | 
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD | 
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| # store all solarized files in one place | |
| mkdir ~/.solarized | |
| cd ~/.solarized | |
| # http://www.webupd8.org/2011/04/solarized-must-have-color-paletter-for.html | |
| git clone https://github.com/seebi/dircolors-solarized.git | |
| eval `dircolors ~/.solarized/dircolors-solarized/dircolors.256dark` | |
| ln -s ~/.solarized/dircolors-solarized/dircolors.256dark ~/.dir_colors | |
| git clone https://github.com/sigurdga/gnome-terminal-colors-solarized.git |