Skip to content

Instantly share code, notes, and snippets.

View srathbun's full-sized avatar

Spencer Rathbun srathbun

View GitHub Profile
@srathbun
srathbun / bisector.sh
Created June 30, 2014 12:48
This file assists git bisects by breaking a commit up on a separate branch
#!/bin/bash -e
# Helps you run a bisect script against your repo and determine which hunk caused a failure
###############################################################################
set -e # exit on command errors (so you MUST handle exit codes properly!)
set -E # pass trap handlers down to subshells
set -o pipefail # capture fail exit codes in piped commands
#set -x # execution tracing debug messages
# Error handler
on_err() {
*.json merge=json_merge
@srathbun
srathbun / tmux.conf
Created July 16, 2014 20:36
My tmux config
set-option -g default-command "reattach-to-user-namespace -l zsh"
# fix colors
set -g default-terminal "screen-256color"
# Arrow movement: nice
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-S-left swap-pane -D
bind -n C-S-right swap-pane -U
@srathbun
srathbun / .gitconfig
Last active August 29, 2015 14:08
.gitconfig
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@srathbun
srathbun / storedProc
Created January 23, 2015 18:33
Example of ambiguous bug
use strict;
use warnings FATAL => 'all';
use MarpaX::Languages::SQL2003::AST;
use Data::Dump qw(pp);
my $input = "";
while (<>) {
$input = $input . $_;
}
@srathbun
srathbun / my.ini
Created July 13, 2012 19:28
Current MySql test settings
# MySQL Server Instance Configuration File
# ----------------------------------------------------------------------
# Generated by the MySQL Server Instance Configuration Wizard
#
#
# Installation Instructions
# ----------------------------------------------------------------------
#
# On Linux you can copy this file to /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options
@srathbun
srathbun / gist:4708226
Created February 4, 2013 17:39
continuous tailing of a log file
#!/bin/bash
crash[1]="disconnected"
crash[2]="38290209"
tail --follow=name log.log | while read line; do
for c in "${#crash[@]}"
do
#echo "Crash Word:" $c
if [[ "$item" == *"$c"* ]]; then
echo "RiotShield has crashed."
echo "Killing RiotShield."
@srathbun
srathbun / .ctags
Created April 18, 2013 20:27
This is a working ctags config for use with vim and javascript. Note that if there is any busted options in this config, ctags will not use *any* of the other options! This means you cannot use comments or blank lines in this file!
--recurse=yes
--tag-relative=yes
--exclude=.git
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\{/\5/o,object/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\5/f,function/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*\[/\5/a,array/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[^"]'[^']*/\5/s,string/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*(true|false)/\5/b,boolean/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*[0-9]+/\5/n,number/
--regex-Javascript=/(,|(;|^)[ \t]*(var|let|([A-Za-z_$][A-Za-z0-9_$.]+\.)*))[ \t]*([A-Za-z0-9_$]+)[ \t]*=[ \t]*.+([,;=]|$)/\5/v,variable/
@srathbun
srathbun / refs.sh
Created May 1, 2013 20:45
Magic portable indirect references for shell.
setref()
{
if [ -n "$1" ]; then
eval $1=$2
else
echo "Null parameter passed to this function"
fi
}
deref()
{
@srathbun
srathbun / posix compliant word splitting read loop
Created May 9, 2013 15:08
how to split a single line with read in a posix manner ( no arrays )
#!/bin/dash
echo "a,b,c" | while read line; do
IFS=','
set -- $line
for word in "$@"; do echo "$word"; done
done