Skip to content

Instantly share code, notes, and snippets.

View scottstanfield's full-sized avatar
🚀
:wq

Scott Stanfield scottstanfield

🚀
:wq
  • Relativity Space
  • California
  • 22:10 (UTC -07:00)
View GitHub Profile
@scottstanfield
scottstanfield / foo.bash
Created August 25, 2017 21:48
die() bash function to echo message then exit with preserved return code
#!/usr/bin/env bash
die() {
ret=$?
printf "%s\n" "$@" >&2
exit "$ret"
}
true || die "You should not see this message."
false || die "Simulate a command that failed"
@scottstanfield
scottstanfield / foo.sh
Created May 31, 2017 05:41
restart program when a file changes
#!/bin/sh
# Tested on Ubuntu 16.04. Requires `inotify-tools`
# sudo apt install inotify-tools
# What this does:
# a) run program $1 in the background
# b) kill then restart $1 if file $2 changes
while true; do
$1 &
PID=$!
@scottstanfield
scottstanfield / fread.r
Created April 9, 2017 05:57
time datatable::fread() and dump sessionInfo
#!/usr/bin/env Rscript
library(data.table)
print(version)
print(sessionInfo())
fn <- commandArgs(trailingOnly=T)[1]
cat(sprintf('\nTiming fread("%s")\n', fn))
t <- system.time({
@scottstanfield
scottstanfield / nuke.microsoft-r-open.sh
Last active April 8, 2017 01:02
forcefully remove Microsoft R Open 3.3 and reinstall
#!/usr/bin/env bash
sudo rm -r /usr/lib/64/microsoft-r
sudo rm -r /usr/lib/R
sudo dpkg --list | grep microsoft
sudo dpkg --purge microsoft-r-open-mkl-3.3
sudo dpkg --purge microsoft-r-open-foreachiterators-3.3
sudo dpkg --purge microsoft-r-open-mro-3.3
sudo dpkg --install microsoft-r-open-foreachiterators-3.3.deb
sudo dpkg --install microsoft-r-open-mro-3.3.deb
sudo dpkg --install microsoft-r-open-foreachiterators-3.3.deb
@scottstanfield
scottstanfield / .zshrc
Last active March 19, 2024 08:33
sensible, minimal .zshrc
# Sensible, short .zshrc
# Gist page: git.io/vSBRk
# Raw file: curl -L git.io/sensible-zshrc
# GNU and BSD (macOS) ls flags aren't compatible
ls --version &>/dev/null
if [ $? -eq 0 ]; then
lsflags="--color --group-directories-first -F"
else
lsflags="-GF"

Brunswick Stew Master Recipe

A modification from the original World Famous Brunswick Stew recipe listed on the Brunswick, GA "Stewbilee" Festival web site, as reported as the second recipe on His Blessed Kid.

Their version called for 1/4 cup of liquid smoke at the end, which we found was way too much. You can always add more, but 1/4 cup ruined it. Start with 2 teaspoons instead; you can always add more.

This is tested and, to me, really gets close to the Brunswick Stew from Vandy's in Statesboro, Georgia.

First the sauce:

#!/bin/sh
# abort if we're already inside a TMUX session
[ "$TMUX" == "" ] || exit 0
# startup a "default" session if non currently exists
# tmux has-session -t _default || tmux new-session -s _default -d
count=`tmux ls 2> /dev/null | wc -l`
echo $count
@scottstanfield
scottstanfield / 5-letter-colors.txt
Created September 21, 2016 21:34
A set of 5-letter colors, from A-Z
amber
black
cedar
denim
ebony
folly
grape
hazel
ivory
jaffa
@scottstanfield
scottstanfield / -
Created July 18, 2016 04:49
temporary
###############################################################################
# Disable caps lock #
###############################################################################
# Delete old entries first
# Normally these do not have an entry for com.apple.keyboard.modifiermapping.*
# Sometimes there is more than one (maybe caused by upgrade?)
old_ifs="$IFS"
export IFS=$'\n'
for plist in ~/Library/Preferences/ByHost/.GlobalPreferences.*.plist; do
keys=$(/usr/libexec/PlistBuddy -c 'Print' "$plist" | egrep 'com\.apple\.keyboard\.modifiermapping.[0-9]' | awk '{ print $1 }')
@scottstanfield
scottstanfield / caps-to-ctrl.macos.sh
Last active October 26, 2016 15:34
map capslock to control on macOS
#!/usr/bin/env bash
# The purpose of this script is to simply turn the CAPS LOCK key into a CONTROL key.
# Does the same thing as System Preferences | Keyboard | Modifier Keys...
# I modified from https://github.com/mathiasbynens/dotfiles/issues/310
# Added the ioreg vendor/product code lookup for current keyboard,
# instead of hardcoding one. This might only work for the onboard keyboard.
# Delete old keyboard.modifiermapping entries first