Skip to content

Instantly share code, notes, and snippets.

Avatar

Jyrki Pulliainen nailor

View GitHub Profile
View gist:7f4ddb3a76c325b5bab5
[~/tmp/ppathtest]$ mkdir bar
[~/tmp/ppathtest]$ mkdir foo/package
[~/tmp/ppathtest]$ mkdir bar/package
[~/tmp/ppathtest]$ echo '__import__("pkg_resources").declare_namespace(__name__)' > bar/package/__init__.py
[~/tmp/ppathtest]$ echo '__import__("pkg_resources").declare_namespace(__name__)' > foo/package/__init__.py
[~/tmp/ppathtest]$ touch foo/package/herp.py
[~/tmp/ppathtest]$ touch bar/package/herp.py
View tmux.conf
set-option -g prefix C-z
unbind-key C-b
bind-key C-z last-window
bind-key z send-prefix
bind-key A command-prompt "rename-window %%"
set -g base-index 1
set -g default-terminal "screen-256color"
set-option -g history-limit 10000
View gist:04ab39803675c5e6dd4d
### Keybase proof
I hereby claim:
* I am nailor on github.
* I am nailor (https://keybase.io/nailor) on keybase.
* I have a public key whose fingerprint is 6862 A7F2 9708 2F26 C7F4 E8A4 A2E8 A2FF 1E37 A353
To claim this, I am signing this object:
View uri-to-psql.py
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import urlparse
def main(url):
result = urlparse.urlparse(url)
@nailor
nailor / ssh_config tunneling
Last active Dec 31, 2015
Denote hosts that need to be tunneled with +
View ssh_config tunneling
Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
ForwardAgent yes
ForwardX11 no
Host tunnel
Hostname nönönö
DynamicForward localhost:1080
ProxyCommand none
@nailor
nailor / sparkeybench.py
Created Sep 13, 2013
Dead simple benchmark for testing sparkey. Running: $ python <amount-of-entries> <amount-of-random-reads> (or use pypy, speed guaranteed)
View sparkeybench.py
from __future__ import print_function
import os
import sys
import sparkey
import tempfile
import timeit
from random import randint
@nailor
nailor / multitmux.sh
Created Apr 19, 2012
Open ssh connections from stdin to multiple tmux panes
View multitmux.sh
multitmux() {
read first;
tmux -q new-session -d -s $1 "ssh -t $first";
tmux set-option quiet on
tmux -q set-option -t $1 mouse-select-pane on
tmux -q set-window -g -t $1 synchronize-panes on
while read host; do
tmux -q split-window -p 25 -v -t $1 "ssh -t $host" 2>/dev/null;
if [ "$?" == "1" ]; then
# If pane is too small, change layout and retry opening
View sala.sh
sget () {
sala -r $1 | cut -f 2 -d ':' | \
tr -d '[:space:]'|xclip -selection clipboard;
}
# Set sala completion for sget
complete -o nospace -F _sala sget
View instagram.py
def form_preference_list(image, edge, others):
def g():
for other_edge in others:
yield (other_edge, image.row_dist(edge, other_edge))
return [x[0] for x in sorted(g(), key=operator.itemgetter(1))]
def stable_matching(image, lefts, rights):
free_left = set(lefts)
right_edges = set(rights)
View Makefile
# Makefile for LaTeX files
# Original Makefile from http://www.math.psu.edu/elkin/math/497a/Makefile
# Please check http://www.acoustics.hut.fi/u/mairas/UltimateLatexMakefile
# for new versions.
# Copyright (c) 2005,2006 (in order of appearance):
# Matti Airas <Matti.Airas@hut.fi>
# Rainer Jung