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
import datetime | |
def parse_date(date_string, format='%Y-%m-%d', seg=','): | |
''' defualt date_string == 'yesterday' | |
available alias 'week','month','year' or timestr: '2013-0101' | |
relativedate = latest_parse_date or today | |
parse_date('2011-01-01') | |
=> datetime(2011,01,01) |
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
#! /bin/bash | |
state=$(networksetup -getsocksfirewallproxy Wi-Fi | grep ^Enabled: | cut -d : -f 2,2) | |
if [ $state == Yes ] | |
then | |
cmd=off | |
else | |
cmd=on | |
fi |
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
$ vi ~/.inputrc | |
# $ ssh [press up/down] | |
# ssh remote_a ssh remote_b | |
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
set show-all-if-ambiguous on | |
set completion-ignore-case on |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>local.goagent</string> | |
<key>ProgramArguments</key> | |
<array> |
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
''' git clone | |
https://github.com/maranas/pyNotificationCenter.git | |
https://github.com/thedjpetersen/gmaillib.git | |
(!!!) gmaillib.py line 51 has indents error, add ' ' before 'if' | |
https://github.com/thedjpetersen/gmaillib/blob/master/gmaillib.py#L51 | |
''' | |
import tornado.ioloop | |
from gmaillib import gmaillib |
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
#!/bin/bash | |
# USEAGE: | |
# slowy "remove latest limiter | |
# slowy 20 "set limiter as 20KByte/s for 80 port | |
# another choice (http://slowyapp.com/) | |
if [ {query} ]; then | |
sudo ipfw pipe 1 config bw {query}KByte/s && sudo ipfw add 1 pipe 1 src-port 80 | |
echo 'bandwidth.max is {query}KByte/s for 80 port' | |
else |
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
#!/bin/bash | |
ps=/bin/ps | |
grep=/usr/bin/grep | |
tmux=/usr/local/bin/tmux | |
cmus=/usr/local/bin/cmus | |
cmus-remote=/usr/local/bin/cmus-remote | |
sleep=/usr/local/Cellar/coreutils/8.17/libexec/gnubin/sleep | |
echo {query} # use query like shift $((OPTIND-1)) |
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
#!/bin/sh | |
# Chromium update script | |
# Mac | Linux | ... | |
OS=Mac | |
BASE_URL=http://commondatastorage.googleapis.com/chromium-browser-snapshots/${OS} | |
LATEST_URL=${BASE_URL}/LAST_CHANGE | |
LATEST=$(curl ${LATEST_URL}) | |
_OS=$(tr '[A-Z]' '[a-z]'<<<${OS}) | |
APP_URL=${BASE_URL}/${LATEST}/chrome-${_OS}.zip |
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
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
from BeautifulSoup import BeautifulSoup as Soup | |
limit = 5 # max = 20 | |
feed_url = 'http://feeds.feedburner.com/python-china?format=xml' | |
req = requests.get(feed_url).text |
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
server { | |
resolver 8.8.8.8; | |
access_log off; | |
listen 80 default_server; | |
listen 443 ssl; | |
ssl_certificate /usr/local/nginx/conf/ssl/server.crt; | |
ssl_certificate_key /usr/local/nginx/conf/ssl/server.key; | |
location / { | |
proxy_pass $scheme://$host$request_uri; |