Skip to content

Instantly share code, notes, and snippets.

View ghostsquad's full-sized avatar

Wes McNamee ghostsquad

View GitHub Profile
@ghostsquad
ghostsquad / error_handing_best_practices.md
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
ghostsquad / dominion_links.md
Last active April 28, 2017 17:56
Dominion Storage Links
@ghostsquad
ghostsquad / help_generate.go
Last active January 3, 2018 00:42
VFSGen with Custom FS
// +build ignore
package main
import (
"log"
"github.com/shurcooL/vfsgen"
"go/build"
"net/http"
"os"
@ghostsquad
ghostsquad / keybase.md
Created January 4, 2018 18:55
keybase identity proof

Keybase proof

I hereby claim:

  • I am ghostsquad on github.
  • I am ghostsquad (https://keybase.io/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
ghostsquad / setup.sh
Last active June 9, 2023 18:32
terminal/home setup
# https://github.com/wagoodman/dive
# https://github.com/hadolint/hadolint
# https://www.shellcheck.net/
# https://github.com/johanhaleby/kubetail
# https://github.com/wercker/stern
# https://httpie.org/
# https://github.com/Versent/saml2aws#osx
# https://asdf-vm.com/#/core-manage-asdf-vm
brew tap \
@ghostsquad
ghostsquad / prompt_perf.sh
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.
done
@ghostsquad
ghostsquad / ping-with-timestamp.ps1
Last active October 17, 2022 05:36
powershell-ping-timestamp
ping.exe -t 172.217.14.238 | Foreach{"{0} - {1}" -f (Get-Date),$_} | Tee-Object -Append -FilePath internet-test.log
@ghostsquad
ghostsquad / docker-test.go
Created August 15, 2019 20:36
docker-test.go
func setup() func() {
pool, err := dockertest.NewPool("")
if err != nil {
fmt.Printf("Could not connect to docker: %s\n", err)
os.Exit(1)
}
pool.MaxWait = time.Second * 120
// pulls an image, creates a container based on it and runs it
@ghostsquad
ghostsquad / .aliases
Created September 4, 2019 19:33
aliases
# 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
# https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git-extras/git-extras.plugin.zsh
@ghostsquad
ghostsquad / aws-creds-to-env.sh
Created September 4, 2019 19:34
aws creds to env vars
#!/usr/bin/env bash
function aws-creds-to-env {
profile_name="${1:-default}"
AWS_ACCESS_KEY_ID=$(aws configure get "${profile_name}.aws_access_key_id")
export AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=$(aws configure get "${profile_name}.aws_secret_access_key")
export AWS_SECRET_ACCESS_KEY
}