Skip to content

Instantly share code, notes, and snippets.

View clvrobj's full-sized avatar

Chi Zhang clvrobj

  • Singapore, Singapore
View GitHub Profile
r1 = {'a': {'q': 1, 'w': 2}, 'b': {'q': 3, 'w': 4}}
r2 = {'a': {'q': 5, 'w': 7}, 'b': {'q': 8, 'w': 2}}
# ret = {'a': {'q': 6, 'w': 9}, 'b': {'q': 11, 'w': 6}}
a = lambda x, y: list(zip(x.keys(), list(zip(x.values(), y.values()))))
rs = reduce(a, (r1, r2))
print rs
#print reduce(a, map(lambda r: r[1], rs))
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@disinfeqt
disinfeqt / gist:2286703
Created April 2, 2012 19:47
YYETS Copy
(function(){
var output = '';
for(var i = 0,array = document.querySelectorAll('.hover.filebox')[0].querySelectorAll('li'); i<array.length-1; i++){
if(array[i].querySelector('input').checked && array[i].querySelector('a').href.length > 0 && array[i].querySelector('a').href.match('-----') === null){
output += array[i].querySelector('a').href + '\n';
}
}
alert(output);
})();
#ab -n 100000 http://127.0.0.1:8880/hello/world
#You have to run Sentry at 127.0.0.1:8000 and replace the following DSN.
from bottle import route, run
@route('/hello/:name')
def index(name='World'):
from raven import Client
client = Client('http://48ca560b5e2b4fe8b8802ed29c54de81:[email protected]:8000/2')
client.captureMessage('hello world!')
@zythum
zythum / gist:2848881
Created June 1, 2012 04:50
google收录的敏感词
@CNBorn
CNBorn / gist:3404994
Created August 20, 2012 15:03
brew:mysql installation completed.
==> Pouring mysql-5.5.25a.snowleopard.bottle.tar.gz
==> Caveats
Set up databases to run AS YOUR USER ACCOUNT with:
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
To set up base tables in another folder, or use a different user to run
mysqld, view the help for mysqld_install_db:
mysql_install_db --help
@omz
omz / FileTransfer.py
Last active September 6, 2024 01:50
File Transfer script for Pythonista (iOS)
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
# and to Pythonista via local Wifi.
# It starts a basic HTTP server that you can access
# as a web page from your browser.
# When you upload a file that already exists, it is
# renamed automatically.
# From Pythonista's settings, you can add this script
# to the actions menu of the editor for quick access.
@suzaku
suzaku / x.py
Created October 11, 2012 03:56
"""This would outputs
x
True
__main__
False
"""
import x
@jjgod
jjgod / my-setup.markdown
Last active May 22, 2024 22:52
My setup
@clvrobj
clvrobj / douban.com.js
Created December 15, 2012 13:59
for the coming annoying douban's new nav bar
$('.nav').css({'margin-bottom':'30px'});
$('.nav-primary').css({'padding':0});
$('.nav-logo a').attr('href', 'http://www.douban.com/update/');
$('.nav-logo').css({'height':'52px'});
$('#db-nav-sns .nav-items ul').append('<li><a href="http://www.douban.com/group/">小组</a></li>');