Skip to content

Instantly share code, notes, and snippets.

View ghostsquad's full-sized avatar

Wes McNamee ghostsquad

View GitHub Profile
ghostsquad /
Last active March 30, 2017 21:59
How to define and handle error conditions

Exception/Error Handling and Logging

Log Levels

First, let's define various error levels (log levels).

Fatal/Critical: The application composition root should look something like this:

def main(*args)
ghostsquad /
Last active April 28, 2017 17:56
Dominion Storage Links
ghostsquad / help_generate.go
Last active January 3, 2018 00:42
VFSGen with Custom FS
// +build ignore
package main
import (
ghostsquad /
Created January 4, 2018 18:55
keybase identity proof

Keybase proof

I hereby claim:

  • I am ghostsquad on github.
  • I am ghostsquad ( on keybase.
  • I have a public key whose fingerprint is 60B0 DC04 C579 39BF 8AC6 0688 1C08 DB44 DEC7 CAFC

To claim this, I am signing this object:

ghostsquad /
Created February 28, 2019 15:20
Measure Prompt Performance
#! /usr/bin/env bash
for i in $(seq 1 10); do
start=$(($(date +%s%N)/1000000))
print -P $PS1 $RPS1;
end=$(($(date +%s%N)/1000000))
echo Execution time was `expr $end - $start` ms.
ghostsquad / docker-test.go
Created August 15, 2019 20:36
func setup() func() {
pool, err := dockertest.NewPool("")
if err != nil {
fmt.Printf("Could not connect to docker: %s\n", err)
pool.MaxWait = time.Second * 120
// pulls an image, creates a container based on it and runs it
ghostsquad / .aliases
Created September 4, 2019 19:33
# Docker
alias drd='docker rmi $(docker images -f "dangling=true" -q)'
alias dre='docker rm $(docker ps -a -f status=exited -q)'
alias drc='docker rm $(docker ps -a -f status=created -q)'
alias dps='docker ps --format '\''table {{ .ID }}\t{{ .Image }}\t{{ .Names }}\t{{ .Ports }}'\'''
alias dpsa='docker ps -a --format '\''table {{ .ID }}\t{{ .Image }}\t{{ .Names }}\t{{ .Ports }}'\'''
# Git
ghostsquad /
Created September 4, 2019 19:34
aws creds to env vars
#!/usr/bin/env bash
function aws-creds-to-env {
AWS_ACCESS_KEY_ID=$(aws configure get "${profile_name}.aws_access_key_id")
AWS_SECRET_ACCESS_KEY=$(aws configure get "${profile_name}.aws_secret_access_key")
git config --local
git config --local user.signingkey 1C08DB44DEC7CAFC
git config --local core.sshCommand "ssh -i ~/.ssh/id_rsa_ghostsquad"
git --no-pager config --local --list
#!/usr/bin/env bash
# Start SSH Agent if not already started
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded