Skip to content

Instantly share code, notes, and snippets.

Douglas Stebila dstebila

Block or report user

Report or block dstebila

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dstebila
dstebila / ds_benchmark.h
Last active Aug 16, 2018
C macros for performance testing
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:

@dstebila
dstebila / solarized.sh
Created Dec 31, 2014
Solarized colours as tcsh shell variables
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%}"
@dstebila
dstebila / bin2hex.sh
Created Oct 21, 2014
Shell script to convert binary to hex
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'
@dstebila
dstebila / hex2bin.sh
Created Oct 21, 2014
Shell script to convert hex file to binary, stripping out any comments
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' | \
You can’t perform that action at this time.