Skip to content

Instantly share code, notes, and snippets.

@jbedo
jbedo / gist:544595
Created August 23, 2010 01:44
Config for uniwireless @ unimelb
We couldn’t find that file to show.
@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 / 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 / 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 / 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 / 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 / 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 / relevel.c
Created March 20, 2011 09:35
Adjusts image contrast
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <memdraw.h>
static double Ptop = 0.995;
static double Pbot = 0.01;
typedef struct range range;
struct range{
@jbedo
jbedo / gist:888244
Created March 26, 2011 12:33
S3Venti port to plan 9
diff -Naur old/mkfile new/mkfile
--- old/mkfile Mon Feb 11 04:27:13 2008
+++ new/mkfile Sat Mar 19 16:34:15 2011
@@ -1,6 +1,4 @@
-<$PLAN9/src/mkhdr
-
-MKSHELL=rc
+</$objtype/mkfile
CFLAGS=$CFLAGS
@jbedo
jbedo / tempmon.c
Created July 1, 2011 10:37
ATI temperature controller
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<math.h>
#include<string.h>
#include<limits.h>
#define NADAPTERS 4
static const int MAXCLOCK = 950;
static const int MINCLOCK = 500;