Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
eatnumber1 / README
Created September 30, 2010 22:43
Object-Oriented C
Your compiler must support blocks.
To compile, run ONE of the following:
gcc -o ooc -std=c99 -fblocks ooc.c
clang -o ooc ooc.c
The output looks like this:
Integer: 1337
String: "Hello World!"
@eatnumber1
eatnumber1 / drink.cgi
Created April 21, 2011 15:42
Drink Sunday -> HTTP Proxy
#!/bin/zsh
emulate -L zsh
typeset -r PROGRAM="$0"
function parent() {
typeset -r HOST="${${PROGRAM##*/}%\.cgi}.csh.rit.edu"
echo "Content-Type: text/plain"
echo
CHILD=1 exec /usr/bin/socat OPENSSL:"$HOST":4243,cafile=/etc/ssl/certs/csh-ca.pem EXEC:"$PROGRAM",fdin=3,fdout=4,sighup,sigint,sigquit
}
@eatnumber1
eatnumber1 / .gitignore
Created May 30, 2011 16:40
Koluring: Coloring text for your terminal.
.*.swp
@eatnumber1
eatnumber1 / .gitignore
Created July 9, 2011 05:32
NSD OpenDNSSEC Notifier
nsd-notify
@eatnumber1
eatnumber1 / drt.d
Created July 31, 2011 05:34
D Runtime Initialization Routine Wrapper
import core.atomic;
import core.runtime;
import core.sync.mutex;
version( Windows ) {
import core.stdc.stdlib;
} else version( Posix ) {
import core.sys.posix.stdlib;
} else {
static assert(false, "Unknown platform");
@eatnumber1
eatnumber1 / stuffs.zsh
Created August 10, 2011 17:45 — forked from agargiulo/stuffs.zsh
simple zsh script
#!/bin/zsh
emulate -L zsh
setopt err_exit
if [[ $# -ne 1 ]]; then
printf "Usage: %s session_name\n" "$0" >&2
exit 1
fi
readonly SOCKDIR="/var/run/screen/S-${USER}"
@eatnumber1
eatnumber1 / foo.mk
Created August 18, 2011 05:55
Thoughts on make extensions
CC ?= gcc
CXX ?= g++
.PHONY: all
all: foo.o foopp.o
foo.o: foo.c
$(CC) -c -o $< $@
@eatnumber1
eatnumber1 / cmdsh.zsh
Created August 26, 2011 17:02
cmdsh: A pile of hacks.
#!/bin/zsh
emulate -L zsh
setopt err_exit
#setopt xtrace
typeset -r NONLINK_PROGNAME="cmdsh"
typeset -r PROGNAME="${0##*/}"
typeset -r CONIN="/usr/local/bin/conin"
typeset -r WINPWD="$(cygpath -w "$PWD")"
typeset -a winargs arguments
@eatnumber1
eatnumber1 / resolve
Created October 11, 2011 13:17
Dynamic linking example
A hand-crafted dynamic resolver.
uint64_t zigbees[3]; // This somehow gets initialized (list of zigbee IDs)
int xbfd;
xbapi_op op_structs[3];
xbfd = xbapi_init("path to fd");
for (int i = 0; i < 3; i++) {
xbapi_initi_op(op_structs[i]);
xbapi_transmit(op_structs[i], "Hello Zigbee", zigbees[i]); // Should return error codes
}