Skip to content

Instantly share code, notes, and snippets.

@jbedo
jbedo / bdeal.c
Created March 6, 2011 09:30
Deals bridge hands and outputs in either a pretty format or PBN
#include<u.h>
#include<libc.h>
#define CHILD(x) ((x) * 2 + 1)
enum{
Nsuits = 4,
Ncards = 13,
Ntot = Nsuits * Ncards,
Nplayers = 4
@jbedo
jbedo / gist:828991
Created February 16, 2011 07:27
Aligning time series
align2 <- function(x, y)
{
# FFT
pad <- rep(0, length(x))
xp <- c(pad, x, pad)
yp <- c(pad, y, pad)
fx <- fft(xp)
fy <- fft(yp)
# Correlation
@jbedo
jbedo / mkventi
Created February 13, 2011 12:59
My version of http://sphericalharmony.com/plan9/makeventi for creating venti stores
#!/opt/plan9/bin/rc
. 9.rc
path = ($PLAN9/bin/venti $path)
arenasize = $1
isectsize = `{echo 'int('^$arenasize^'*0.05)' | hoc}
bloomsize = 512
touch venti.conf
@jbedo
jbedo / Decoding urls
Created December 15, 2010 14:43
Dedode urls (echo '%22%C3%B6%22'|urldecode)
urldecode(){
echo -e "$(sed 's/+/ /g; s/%/\\x/g')"
}
@jbedo
jbedo / wmiirc_local
Created August 24, 2010 01:00
Add battery charge state and level (need smapi) to the wmii status bar
status() {
echo -n $(cat /sys/devices/platform/smapi/BAT0/state) $(cat /sys/devices/platform/smapi/BAT0/remaining_percent) '|' $(uptime | sed 's/.*://; s/,//g') '|' $(date)
}
@jbedo
jbedo / wmiirc_local
Created August 23, 2010 04:57
Configure volume control keys under wmii
local_events() {
cat << '!'
Keygroup Multimedia
Key XF86AudioMute
amixer sset Master toggle
Key XF86AudioLowerVolume
amixer sset Master 2-
Key XF86AudioRaiseVolume
amixer sset Master 2+
@jbedo
jbedo / gist:544595
Created August 23, 2010 01:44
Config for uniwireless @ unimelb
We couldn’t find that file to show.