Skip to content

Instantly share code, notes, and snippets.

View GauntletWizard's full-sized avatar

Ted Hahn GauntletWizard

View GitHub Profile
@GauntletWizard
GauntletWizard / Debug Pod
Last active June 16, 2025 03:48
Kube Tricks
kubectl --context CLUSTER run --image ubuntu pgtool -- /bin/bash -c "apt-get update; apt-get install -y postgresql-client; trap : TERM INT; sleep infinity & wait"
kubectl --context gke_lido-staging_us-east1_lido-staging-us-east1 run --image redis redis -- /bin/bash -c "trap : TERM INT; sleep infinity & wait"
kubectl --context CLUSTER run --image amazon/aws-cli --command --overrides='{"spec": { "serviceAccountName": "default"}}' cli -- /bin/bash -c "trap : TERM INT;sleep infinity"
yq -o json '.spec.template | .metadata.name="bc-test" | .kind = "Pod" | .apiVersion = "v1" | .spec.containers[].command = ["/bin/bash", "-c", "sleep 86400"] | .spec.containers[].livenessProbe=null | .spec.containers[].readinessProbe=null' deployment.yaml | kubectl apply -f -
@GauntletWizard
GauntletWizard / honeysave.sh
Created April 13, 2018 22:59
Saves honeycomb boards for version control purposes
#!/bin/bash
# honeysave.sh - Saves honeycomb boards for version control purposes
WRITEKEY=""
honeycurl() {
curl -H "X-Honeycomb-Team: ${WRITEKEY}" https://api.honeycomb.io/1/boards/$*
}
save() {
@GauntletWizard
GauntletWizard / k8s.md
Created February 23, 2018 18:15
Intro to K8s

Read one link per day, mull on it, and ask clarifying questions from your local SRE

  • What is a deployment?
    • Don't ready the whole doc - It's long and technical. Just read the preview, and know the primitives it mentions - Create, Update, Rollback, Scale, Pause, Status, Cleanup.
  • Pods
  • Persistent Volumes in k8s.
    • Editorializing for a bit; there's a bunch here, its very complex and only adds more. There's very few good reasons to use volumes. It doesn't reduce complexity vs. provisioning your backing store in more traditional ways. K8s is great because we're moving to stateless microservices; for stateful services like database backends, generally a losing proposition. Except when you can rapidly and automatically rebuild from quorum; I'll discuss those later.
  • [What is a node?](https://kuber
@GauntletWizard
GauntletWizard / gimpgradientanimate.py
Created October 31, 2017 20:47
Animate a transition between two images in GIMP.
# Find our image, and first and last images.
# Gimp GIF export animates from bottom to top, so these are backwards.
foo = gimp.image_list()[0]
start = foo.layers[0]
end = foo.layers[1]
start.visible = False
end.visible = False
# Step - How much we increase opacity each time.

Must Dos:

  • Use terraform, or other declarative infrastructure
  • Use Organizations for billing. Set up an Org account, with an Infra account for build artifacts/login, and development, staging, and prod accounts with appropriate permissions.
  • Developers should all have admin permissions in dev, and only necessary permissions in staging and prod. Staging should be exactly like prod except that customers aren't using it. Dev should be as close as possible, with any changes being backed out and repeated in staging before they make it to staging.

Useful tools:

Stretch Goals:

#!/usr/bin/env python
# gceips.py - A script to print the cidr ranges of all of GCE.
# https://cloud.google.com/compute/docs/faq#where_can_i_find_short_product_name_ip_ranges
import re
# pip install dnspython
import dns.resolver
from dns.rdatatype import TXT
includesmatch = re.compile(r'include:([\w\.-]*)')

Keybase proof

I hereby claim:

  • I am gauntletwizard on github.
  • I am gauntletwizard (https://keybase.io/gauntletwizard) on keybase.
  • I have a public key ASA3GF3F2JAd_WN9-svtXfeDHDvSu7WiLV1V2L0n01gw8Qo

To claim this, I am signing this object:

@GauntletWizard
GauntletWizard / Pipefail example
Created May 23, 2016 06:48
An example of how to use the pipefail option, and how it works.
set -e
set -x
true | false |true
echo "done"
set -o pipefail
true | false ||true