Skip to content

Instantly share code, notes, and snippets.

View fanweixiao's full-sized avatar
🦖
hacking on @yomorun

C.C. fanweixiao

🦖
hacking on @yomorun
View GitHub Profile
@fanweixiao
fanweixiao / gist:9533725
Last active August 29, 2015 13:57
/Interface/Search/getAllIndex json response
{ "data" : { "all" : [ { "area" : "0",
"areaName" : "全国",
"key" : "taylor swift",
"period" : "20110101|20140311",
"ratio" : { "agv_m" : "6064",
"agv_w" : "7079",
"qoq_m" : "-17",
"qoq_w" : "32",
"yoy_m" : "-44",
"yoy_w" : "-30"
@fanweixiao
fanweixiao / hosts
Created July 1, 2014 17:27
dropbox hosts file
108.160.166.62 dropbox.com
108.160.166.62 www.dropbox.com
108.160.166.140 client-lb.dropbox.com
107.20.134.222 dl.dropbox.com
107.20.134.222 dl-web.dropbox.com
23.21.206.219 forums.dropbox.com
108.160.165.211 notify0.dropbox.com
108.160.165.211 notify1.dropbox.com
108.160.165.211 notify2.dropbox.com
108.160.165.211 notify3.dropbox.com
<?xml version="1.0"?>
<root>
<item>
<name>Switch Input Source</name>
<appendix>Use the right Option key to select the next input source</appendix>
<identifier>private.switch_input_source_with_right_option</identifier>
<autogen>--KeyToKey-- KeyCode::OPTION_R, KeyCode::SPACE, ModifierFlag::OPTION_L</autogen>
</item>
<item>
@fanweixiao
fanweixiao / cayley_antigfw
Last active August 29, 2015 14:05
Anti-GFW when using `cayley http`
if [ `builtin type -p gsed` ]; then
gsed -i 's/fonts.googleapis.com/fonts.useso.com/g' templates/head.tmpl
gsed -i 's/ajax.googleapis.com/ajax.useso.com/g' templates/head.tmpl
gsed -i 's/fonts.googleapis.com/fonts.useso.com/g' static/third_party/flatly/bootstrap.min.css
else
sed -i 's/fonts.googleapis.com/fonts.useso.com/g' templates/head.tmpl
sed -i 's/ajax.googleapis.com/ajax.useso.com/g' templates/head.tmpl
sed -i 's/fonts.googleapis.com/fonts.useso.com/g' static/third_party/flatly/bootstrap.min.css
fi
var util = require('util');
var events = require('events');
var redis = require('redis');
var RedisQueueConsumer = function (port, host) {
events.EventEmitter.call(this);
this.port = port || 6379;
this.host = host || '127.0.0.1';
};
@fanweixiao
fanweixiao / gist:04259bc2a3948d194d92
Created August 24, 2015 09:24
git ssh over socks5 proxy
Host bitbucket.org
Hostname bitbucket.org
Port 22
User git
ProxyCommand nc -x localhost:7070 %h %p
@fanweixiao
fanweixiao / cpojer.zsh-theme
Created November 24, 2011 22:59 — forked from cpojer/cpojer.zsh-theme
My zsh theme
# ZSH Theme by @cpojer
PROMPT='[%{$fg[red]%}%n%{$fg[black]%}: %{$fg[blue]%}%~%{$reset_color%}\
$(git_prompt_info)\
%{$fg[black]%}%(!.#.]$)%{$reset_color%} '
PROMPT2=''
RPS1=''
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%} %{$fg[yellow]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}"
@fanweixiao
fanweixiao / urlmonitor
Created March 5, 2012 09:00 — forked from peterc/urlmonitor
urlmonitor - print out the URLs requested system wide on the main network interface
# urlmonitor - print out the URLs requested system wide on the main network interface
# Accept a network interface name as an optional argument
iface = ARGV.first
# No interface specified? Try to guess which one is king..
unless iface
`ifconfig -l`.split.each do |iface|
next if iface =~ /^lo/
break if `ifconfig #{iface}` =~ /inet (0|1|2)/
require 'net/http'
require 'uri'
RIAK = ['localhost', 8098]
run lambda { |env|
req = Rack::Request.new(env)
if req.post? && req.path == '/'
res = Net::HTTP.new(*RIAK).start do |http|
http.post('/riak/shrt', req.params['url'], { 'Content-Type' => 'text/plain' })
git remote add --track master upstream git://github.com/upstreamname/projectname.git