I hereby claim:
- I am boneyao on github.
- I am boneyao (https://keybase.io/boneyao) on keybase.
- I have a public key whose fingerprint is 1273 C7B2 AA2D F4F3 6640 430E ADF2 2F50 B8E0 2E59
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import cProfile | |
import functools | |
import pstats | |
from cStringIO import StringIO | |
def profile(func): | |
@functools.wraps(func) | |
def wrapped(*args, **kwargs): |
nginx_format = '$remote_addr => $upstream_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_cookie" $request_time $upstream_response_time "$proxy_add_x_forwarded_for" $upstream_cache_status' | |
_map = { | |
'$remote_addr': '%h', | |
'$upstream_addr': '%^', #nq | |
'$time_local': '%d:%t +0800', | |
'$request': '%r', | |
'$status': '%s', | |
'$body_bytes_sent': '%b', | |
'$http_referer': '%R', | |
"$http_user_agent": '%u', |