Skip to content

Instantly share code, notes, and snippets.

(for branch in $(git branch -l) ; do git archive $branch | tar -l ; done) | sort | uniq
for branch in $(git branch -r | grep -v HEAD) ; do git branch --track $(echo $branch | cut -f2- -d/) $branch ; done
@willb
willb / ptr_inspect.c
Created October 3, 2008 01:57
This is some example code showing how to use the ptrace system call under Linux to trace the system calls of a child process.
/*
ptr_inspect.c
Demonstration code; shows how to trace the system calls in a child
process with ptrace. Only works on 64-bit x86 Linux for now, I'm
afraid. (Even worse, it's only tested on Linux 2.6....)
The callname() function looks clunky and machine-generated because it
*is* clunky and machine-generated.
#!/usr/bin/env python
# encoding: utf-8
"""
addmint.py
Adds Mint analytics to a static HTML page; requires BeautifulSoup.
(I use this for Aperture exports.)
Created by Will Benton on 2008-07-15.
#!/bin/sh
# you probably want automatic git-gc before running this:
# git config --global gc.auto 1
mkdir jikesrvm.svn.sourceforge.net
(cd jikesrvm.svn.sourceforge.net && rsync -avz jikesrvm.svn.sourceforge.net::svn/jikesrvm/\* .)
git svn clone -s file://$(pwd)/jikesrvm.svn.sourceforge.net/rvmroot/ jikesrvm.git
python - << EOF
import sys
vtup = sys.version_info
version = vtup[0] * 100 + vtup[1] * 10 + vtup[2]
if version < 240:
sys.exit(1)
sys.exit(0)
EOF
/*
Simple timing test of exec-ing versus embedding python interpreter.
Note that to embed python programs with dynamically loaded extension
modules, you'll need to do some special linking tricks:
http://www.python.org/doc/2.5.2/ext/link-reqs.html
Compile this file with something like:
# bit-for-bit copy of the drive at /dev/sda to sda.img on a removable disk
dd if=/dev/sda of=/media/removable/sda.img bs=1024
# convert sda.img to a QEMU disk image
qemu-img convert -f raw sda.img -O qcow sda-qcow.img
# convert sda.img to a vmware disk image
qemu-img convert -f raw sda.img -O vmdk sda.vmdk
// Trivial example of using virtual dispatch to hide template parameters from clients, as
// alluded to here: http://chapeau.freevariable.com/2009/06/a-problem-of-dependent-types.html
#include <iostream>
#include <list>
#include <tr1/memory>
class repr {
public:
virtual ~repr() { }