Skip to content

Instantly share code, notes, and snippets.

@sheldonh
sheldonh / config.ru
Created November 14, 2019 15:13
Rack::RequestTimer
require "time"
module Rack
class RequestTimer
class Timer
FORMAT = "%0.3fms elapsed since %s" unless defined?(FORMAT)
#!/bin/sh
old_version=$1
new_version=$2
inventory=$(chruby-exec $old_version -- gem list -q | sed -e 's/^\([^ ]*\) (\(.*\))/\1:\2/' -e 's/[:,] */:/g')
for item in $inventory; do
gem=${item%%:*}
versions=${item#*:}
versions=$(echo $versions | sed -e 's/:/ /g')
### Keybase proof
I hereby claim:
* I am sheldonh on github.
* I am sheldonh (https://keybase.io/sheldonh) on keybase.
* I have a public key whose fingerprint is 07B7 6119 5FAD 8AAD EDAA 6F64 F42E 096D 615C 2D28
To claim this, I am signing this object:
Feature: Legacy bootstrapping
As a legacy service component
In order to use the configuration service without changing hosting strategy
I want to bootstrap the configuration service from a file.
Scenario: Legacy bootstrapping
Given no environmental service configuration
And a legacy service configuration file
Feature: Legacy bootstrapping
As a legacy service component
In order to use the configuration service without changing hosting strategy
I want to bootstrap the configuration service from a file.
Scenario: Legacy bootstrapping
Given no environmental service configuration
And a service configuration file
client
proto tcp
dev tun
nobind
mssfix
remote vpn-router1.cpt4.host-h.net 443
resolv-retry infinite
script-security 1
@sheldonh
sheldonh / virtualbox-guest.sh
Last active August 29, 2015 14:23
Virtualbox guest setup
#!/bin/sh -e
#
# wget -O virtualbox-guest.sh https://goo.gl/BYGYEx
# chmod +x virtualbox-guest.sh
# sudo ./virtualbox-guest.sh
#
if [ $(id -u) != 0 ]; then
echo "sudo, remember?" 1>&2
exit 1
fi
@sheldonh
sheldonh / setup.sh
Last active May 4, 2016 13:51
Desktop bootstrap
#!/bin/sh
# 1. Install Google Chrome and LastPass
# 2. Fetch secrets from S3
# 3. Profit!
#
# To run:
#
# wget -O setup.sh https://goo.gl/htFGUu
# chmod +x setup.sh
@sheldonh
sheldonh / .bashrc
Created April 15, 2015 09:38
bash git prompt on Fedora
if ! type __git_ps1 &> /dev/null && [ -e /usr/share/git-core/contrib/completion/git-prompt.sh ]; then
. /usr/share/git-core/contrib/completion/git-prompt.sh
fi
if type __git_ps1 &> /dev/null; then
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWCOLORHINTS=1
export PROMPT_DIRTRIM=2
export PROMPT_COMMAND='__git_ps1 "\w" "\\\$ "'
fi
@sheldonh
sheldonh / log_duration.coffee
Created March 24, 2015 13:05
log_duration.coffee
# Logs timing of an operation:
#
# * Start a clock.
# * Calls the `operation`, passing in a `done` function that will:
# * Stop the clock.
# * Log the title of the operation with its elapsed duration and optional outcome.
# If the operation calls the `done` function with no outcome, "completed" is used.
#
# Example:
#