Bash-based delta-debugging

Delta debugging (http://www.st.cs.uni-saarland.de/dd/) is an awesome way
to debug: write a script to decide whether the bug is present, and let the
machine search through all the combinations and find you a minimum sample
case.

The original code is in python, but I find it easier to write such scripts
in bash, so I wrote a simple wrapper. Usage:

  > deltad test.sh < test.in
OS X version of chrpath

Finding the rpaths used by an OS X executable is harder than it should be.
This simple wrapper around otool extract just the rpath data.
debug-sequence, for gdb

Sometimes, breakpoints are not specific enough.
The problematic function A is called many times successfully, then fails
when it is called from function B, and then only when function B is called
from function C. How do you tell gdb to break when C calls B who calls A?
Ask debug-sequence:

  > debug-sequence C B A
extract_lines

head and tails only help you when the lines you are looking for at at
the beginning or end of a file. Sure, you could combine the two, but
it's simpler to just use extract_lines:

  > seq 10 | extract_lines 3-5,7
  3
  4
  5
  7
Bake -pN into a patch

I keep all my patches in a format where "patch -p0" works.
If a tool gives me a patch in another format, I can use this script
to strip the prefix from the patch files "permanently", as opposed
to just during the lifetime of "patch -pN".
Tool to refactor C code to a new file

Refactoring in C is a pain, because you need to create all those header
files. With this script, suffer no more! Code everything in a single C
file, then once that file becomes too unwieldy, select some of its
functions (in vim) and type "!refactor-to-file mylibrary". This will
create "mylibrary.h" and "mylibrary.cpp", and will even replace your
selection with "#include <mylibrary.h>".
Visual Studio to Makefile

If your Visual Studio project is simple enough and cross-platform
enough that the same code could be run from a simple Makefile...
Then it can! This script will convert part of a Visual Studio
solution file to a Makefile script. Advanced (and not that advanced)
Visual Studio features are ignored.
vim file.C:140

vim can open a file at a specified line, but not with the above syntax.
vix can.
xargs with newlines instead of spaces

xargs is super convenient, but it doesn't handle spaces very well.
I often use it with the output of find, which outputs one file per line.
If one of those filenames contains a space, xargs will parse this as two
arguments.

xargs0 doesn't.