Skip to content

Instantly share code, notes, and snippets.

View wilhelm-murdoch's full-sized avatar
💀
Busy being spoopy.

Wilhelm Murdoch wilhelm-murdoch

💀
Busy being spoopy.
View GitHub Profile
@wilhelm-murdoch
wilhelm-murdoch / spongebob
Last active October 22, 2021 13:07
Convert text to "spongebob' format from your command line ...
#!/usr/bin/env bash
set -eo pipefail
[[ -n "${VERBOSE}" ]] && set -x
read text
while [[ $index -lt "${#text}" ]]; do
swap=$(( $RANDOM % 10 ))
@wilhelm-murdoch
wilhelm-murdoch / keybase.md
Created November 7, 2020 03:41
keybase.md

Keybase proof

I hereby claim:

  • I am wilhelm-murdoch on github.
  • I am wilhelm (https://keybase.io/wilhelm) on keybase.
  • I have a public key ASBZm_maWfr3d882kURWC8C-i0iQFkBeuNWDtW2xi6sPxgo

To claim this, I am signing this object:

@wilhelm-murdoch
wilhelm-murdoch / aws.sh
Created July 7, 2020 06:53
Docker-based AWS CLI
#!/usr/bin/env bash
set -eo pipefail
[[ -n "${VERBOSE}" ]] && set -x
metadata() {
curl -s --connect-timeout 2 --fail "http://169.254.169.254/latest/meta-data/$*"
}
@wilhelm-murdoch
wilhelm-murdoch / list.sh
Last active October 22, 2021 13:07
List all unused security groups in all AWS regions ...
#!/usr/bin/env bash
set -eo pipefail
[[ -n "${VERBOSE}" ]] && set -x
for region in $(aws ec2 describe-regions | jq -r '.Regions[].RegionName'); do
for sg in $(aws ec2 describe-security-groups --region="${region}" | jq -r '.SecurityGroups[].GroupId'); do
if [[ $(aws ec2 describe-network-interfaces --region="${region}" --filters Name=group-id,Values="${sg}" | jq -r '.NetworkInterfaces | length') -eq 0 ]]; then
echo "${sg} in ${region}"
@wilhelm-murdoch
wilhelm-murdoch / cidr.py
Last active October 22, 2021 13:08
Ensure given VPC subnets have zero overlap.
#!/usr/bin/env python
import ipaddr
accounts = {
'flood-beta': {
'public': [
'10.1.32.0/20',
'10.1.96.0/20',
'10.1.160.0/20'
@wilhelm-murdoch
wilhelm-murdoch / K8s-DigitalOcean-CoreOS.md
Created March 23, 2018 07:42 — forked from kevashcraft/K8s-DigitalOcean-CoreOS.md
How to Setup Kubernetes on DigitalOcean with CoreOS

Kubernetes on DigitalOcean with CoreOS

Let's look at an example of how to launch a Kubernetes cluster from scratch on DigitalOcean, including kubeadm, an Nginx Ingress controller, and Letsencrypt certificates.

Overview

Environment

We'll be creating a four-node cluster (k8s-master, k8s-000...k8s-002), load balancer, and ssl certificates.

Table of Contents

  1. Install Kubernetes
Gost - A simple command line utility for easily creating Gists for Github
Usage:
gost (--file=<file> | --clip) [--name=<name>] [--description=<description>] [--token=<token>] [--public]
gost (--help | --version)
Options:
-t --token=<token> Optional Github API authentication token. If excluded, your Gist will be created anonymously.
-f --file=<file> Create a Gist from file.
-n --name=<name> Optional name for your new Gist.
Gost - A simple command line utility for easily creating Gists for Github
Usage:
gost (--file=<file> | --clip) [--name=<name>] [--description=<description>] [--token=<token>] [--public]
gost (--help | --version)
Options:
-t --token=<token> Optional Github API authentication token. If excluded, your Gist will be created anonymously.
-f --file=<file> Create a Gist from file.
-n --name=<name> Optional name for your new Gist.
Gost - A simple command line utility for easily creating Gists for Github
Usage:
gost (--file=<file> | --clip) [--name=<name>] [--description=<description>] [--token=<token>] [--public]
gost (--help | --version)
Options:
-t --token=<token> Optional Github API authentication token. If excluded, your Gist will be created anonymously.
-f --file=<file> Create a Gist from file.
-n --name=<name> Optional name for your new Gist.
@wilhelm-murdoch
wilhelm-murdoch / ngNumber.js
Created September 10, 2013 04:19
A better variation of AngularJS' ngNumber filter ...
/**
* Number Filter
* @Param input The number to format
* @Param fractionSize Nubmer of decimal places to round to; defaults to 2
* @Param groupSep Number group separator; defaults to a single space ' '
* @Param decimalSep Decimal place separator; defaults to single period
* @return string, ex: 1 234 345
*/
var DECIMAL_SEP = '.' // change to override default
var GROUP_SEP = ' ' // change to override default