Skip to content

Instantly share code, notes, and snippets.

@devnulled
devnulled / gist:d1993a45bc87643a03a76c6dcd51d125
Last active September 18, 2018 20:43
Run A Command Against a Collection of Kubernetes Resources
# An example of running a command against each persistantvolume of a given storage class in CoolBrosNetes
# Grab the JSON to parse from k8s
kubectl get pv -o json > pv.json
# Parse the JSON with jq and run that shit
jq -r '.items[] | select(.spec.storageClassName=="my-storage-class") | [.metadata.name] | @tsv' pv.json |
while IFS=$'\t' read -r name; do
echo The name is $name
done
@devnulled
devnulled / boot.sh
Created October 2, 2018 22:19
Simple shell script to install crony on boot in the Kubernetes version of Debian to use AWS time servers. Other keywords: time, sync, ntp, ntpd
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
apt-get -q -y install chrony --no-install-recommends
sed -i 's/pool 2.debian.pool.ntp.org iburst/server 169.254.169.123 prefer iburst/g' /etc/chrony/chrony.conf
systemctl restart chrony
@devnulled
devnulled / chrony.conf
Created November 19, 2018 19:04
Default Chrony Config for Debian on AWS
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usuable directives.
#
# Amazon AWS NTP Server
#
server 169.254.169.123 prefer iburst
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
@devnulled
devnulled / fix.sh
Created March 21, 2019 20:35
Deleting Stuck or Hung Kubernetes CRD's and CR's
#
# How to patch and delete CustomResourceDefinitions and CustomResources in Kubernetes
#
#
# Just copied and pasted from this solution in a kubernetes bug report:
#
# https://github.com/kubernetes/kubernetes/issues/60538
#
# remove the CRD finalizer blocking on custom resource cleanup
@devnulled
devnulled / nvm-auto-run.md
Created April 23, 2025 16:31 — forked from tcrammond/nvm-auto-run.md
Automatically nvm use when entering directory

Calling nvm use automatically in a directory with a .nvmrc file

Put this into your $HOME/.zshrc to call nvm use automatically whenever you enter a directory that contains an .nvmrc file with a string telling nvm which node to use:

place this after nvm initialization!