Skip to content

Instantly share code, notes, and snippets.

history={'data': [
{
'o': 0, /* offset */
'h': 1, /* horizontal slide index */
'v': 0, /* vertical slide index */
},
{
'o': 120,
'h': 2,
'v': 0,
/**
* computes the what elements were added to, and removed from, s1
* to obtain s2, where s1 and s2 are assumed to be unordered Array
* possibly with duplicates
* uDiff([1,3], [2,3]) --> {added: [2], removed: [1]}
* uDiff([1,2,3], [2,3,1]) --> {added: [], removed: []}
* uDiff([1,2,1], [1,2,2]) --> {added: [2], removed: [1]}
* @param s1 Array
* @param s2 Array
@io41
io41 / Makefile
Last active August 29, 2015 14:22 — forked from kwlzn/Makefile
PYTHON := python2.6
BUILD_DIR := buildtmp
AURORA_CLUSTER := test
AURORA_ROLE := $(shell whoami)
UWSGI_VER = 2.0.4
UWSGI_DIR = uwsgi-$(UWSGI_VER)
UWSGI_FILE = $(UWSGI_DIR).tar.gz
UWSGI_URL = http://projects.unbit.it/downloads/$(UWSGI_FILE)
# Add this self removing snippet to someone's .bashrc, or .zshrc. #DELETEME
# So next time they ssh in, or open a terminal... NYAN CAT!! #DELETEME
CONF_FILE=$HOME/.bashrc #DELETEME
(sleep 15 && killall telnet > /dev/null 2>&1) & #DELETEME
telnet miku.acm.uiuc.edu #DELETEME
reset #DELETEME
clear #DELETEME
sed '/#DELETEME/d' $CONF_FILE > /tmp/$(basename $CONF_FILE) #DELETEME
cat /tmp/$(basename $CONF_FILE) > $CONF_FILE #DELETEME
rm -f /tmp/$(basename $CONF_FILE) #DELETEME
import functools
import inspect
# OMG, what have I done!? (Don't read this bit. Ever.)
class inject(object):
@classmethod
def require(__cls, *args):
def decorator(func):
functools.wraps(func)
#!/bin/sh
# Save this in a file in an empty dir, then run.
__global=./
__object=__mytype
__object_id=my-id
# All events go here
exec 10>$__global/post_config_events
@io41
io41 / gist:1688530
Created January 27, 2012 12:19
ipython / pdb++ setup on OS X
#!/bin/sh
backup()
{
[ -e "$1" ] && mv "$1" "$1.backup.$(date +%s)"
}
backup ~/.pdbrc.py
cat > ~/.pdbrc.py <<EOF
import pdb
class Config(pdb.DefaultConfig):
__profile_d()
{
# i.e. __profile_d_mysql_ssl/foo/bar
local d=$1
[ "$d" ] || exit 0
if [ "${d%__profile_d*}" ]; then
echo "$d"
exit 0
fi
# i.e. foo/bar

Create a public gist:

antimuon:~$ traceroute patents.com
traceroute: Warning: patents.com has multiple addresses; using 199.16.153.11
traceroute to patents.com (199.16.153.11), 64 hops max, 52 byte packets
1 10.0.1.1 (10.0.1.1) 8.736 ms 5.836 ms 4.002 ms
2 * * *
3 83-169-179-86-isp.superkabel.de (83.169.179.86) 41.602 ms 38.353 ms 39.961 ms
4 88-134-192-56-dynip.superkabel.de (88.134.192.56) 13.402 ms 9.123 ms 7.756 ms
5 88-134-204-150-dynip.superkabel.de (88.134.204.150) 11.027 ms 8.134 ms 13.547 ms
6 83-169-128-22.static.superkabel.de (83.169.128.22) 12.880 ms 23.179 ms 26.520 ms
7 88-134-201-117-dynip.superkabel.de (88.134.201.117) 9.068 ms 11.654 ms 10.706 ms