Instantly share code, notes, and snippets.

View ds_benchmark.h
/********************************************************************************************
* ds_benchmark.h: Macros for simple benchmarking of C code.
*
* See instructions for usage below.
* Software originally developed by Douglas Stebila.
* Most recent version at https://gist.github.com/dstebila/6980008ec98209ef6075
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
View keybase.md

Keybase proof

I hereby claim:

  • I am dstebila on github.
  • I am dstebila (https://keybase.io/dstebila) on keybase.
  • I have a public key whose fingerprint is 2ADA 9B8D A02C 2977 D998 FFAA 35A2 F17C 7C8B 45E2

To claim this, I am signing this object:

View solarized.sh
#!/bin/tcsh
# Solarized colours (http://ethanschoonover.com/solarized) as tcsh shell variables
set solarized_base03 = "%{\033[1;30m%}"
set solarized_base02 = "%{\033[0;30m%}"
set solarized_base01 = "%{\033[1;32m%}"
set solarized_base00 = "%{\033[1;33m%}"
set solarized_base0 = "%{\033[1;34m%}"
set solarized_base1 = "%{\033[1;36m%}"
set solarized_base2 = "%{\033[0;37m%}"
View bin2hex.sh
#!/bin/bash
# Read either the first argument or from stdin (http://stackoverflow.com/questions/6980090/bash-read-from-file-or-stdin)
cat "${1:-/dev/stdin}" | \
# Convert binary to hex using xxd in plain hexdump style
xxd -ps | \
# Put spaces between each pair of hex characters
sed -E 's/(..)/\1 /g' | \
# Merge lines
tr -d '\n'
View hex2bin.sh
#!/bin/bash
# Read either the first argument or from stdin (http://stackoverflow.com/questions/6980090/bash-read-from-file-or-stdin)
cat "${1:-/dev/stdin}" | \
# Strip out comments starting with #
sed -E 's/#.*$//' | \
# Strip out comments starting with //
sed -E 's/\/\/.*$//' | \
# Strip out multi-line comments /* ... */
perl -0777 -pe 's{/\*.*?\*/}{}gs' | \