Skip to content

Instantly share code, notes, and snippets.

@thenoviceoof
thenoviceoof / xcompmgr.desktop
Created July 18, 2012 05:08
For nice compositing with xmonad
# .config/autostart/xcompmgr.desktop
[Desktop Entry]
Name=xcompmgr
GenericName=Light Compositor
Exec=xcompmgr
Terminal=false
Type=Application
StartupNotify=false
@thenoviceoof
thenoviceoof / .zshrc
Created July 16, 2012 14:16
super basic .zshrc emacs paste
alias e="emacsclient -nw"
# ...snip...
if [ ! "$(ps -ef | grep -v grep | grep "emacs --daemon")" ]
then
emacs --daemon
fi
export EDITOR="emacsclient -nw"
@thenoviceoof
thenoviceoof / gist:3120818
Created July 16, 2012 05:33
selfspy running check
* * * * * if [ -z "$(pgrep -fl selfspy)" ]; then notify-send -u critical "Selfspy isn't running"; fi
@thenoviceoof
thenoviceoof / shuffle.js
Created July 2, 2012 05:14
Fisher-Yates shuffle in js
// using http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
function randrange(i) {
return Math.floor(i*Math.random());
}
// in-place shuffle
function shuffle(items) {
var tmp;
var i = items.length - 1;
@thenoviceoof
thenoviceoof / du.py
Created July 2, 2012 05:06
du, but with a graphical bar
import os
import sys
path = sys.argv[1]
# http://stackoverflow.com/a/943921/184159
rows, columns = [int(i) for i in os.popen('stty size', 'r').read().split()]
dir = os.listdir(path)
sizes = [os.stat(d).st_size for d in dir]
big = max(sizes)
@thenoviceoof
thenoviceoof / img-1.py
Created June 29, 2012 03:36
photologger
import cv
cv.StartWindowThread()
cv.NamedWindow("hello")
cap = cv.CaptureFromCAM(0)
for i in range(100):
f = cv.QueryFrame(cap)