Skip to content

Instantly share code, notes, and snippets.

View d0k's full-sized avatar

Benjamin Kramer d0k

View GitHub Profile
@d0k
d0k / zshrc
Created January 9, 2009 20:03
my .zshrc
source ~/.profile
autoload zmv
autoload -U compinit
compinit
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BNichts gefunden fuer: %d%b'
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
@d0k
d0k / digitsum.py
Created January 2, 2009 17:54
simple python script to compute the digit sum of an integer
#!/usr/bin/env python
from sys import argv
print(sum(int(x) for x in argv[1]))
@d0k
d0k / wtab.c
Created January 2, 2009 17:50
C program to generate LaTeX truth tables
/* ./wtab n
* creates a truth table for LaTeX with n bits
*/
#include <stdio.h>
#include <stdlib.h>
#define SIZE unsigned long
#define MAXBITS sizeof(SIZE)*8-1
@d0k
d0k / cheader.pl
Created January 2, 2009 17:44
perl script to create empty source files
#!/usr/bin/perl -w
# ./cheader.pl foo.h bar.c qux.py
# creates empty source files
use strict;
sub cheader {
my $guard = uc shift;
$guard =~ tr/\.\/-/_/;
@d0k
d0k / keynotepng.rb
Created October 19, 2008 20:37
ruby script to convert images inside keynote 4 bundles to PNG
#!/usr/bin/env ruby -w
# Converts images inside keynote bundles to PNG
# We need RMagick with tiff support installed
# You may get libtiff from macports
# and RMagick from rubygems
# Licensed under GPLv3
require 'rubygems'