Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Wilhelm Murdoch wilhelm-murdoch

🎯
Focusing
View GitHub Profile
View 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 Jul 7, 2020
Docker-based AWS CLI
View aws.sh
#!/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 Dec 30, 2019
List all unused security groups in all AWS regions ...
View list.sh
#!/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 Feb 14, 2019
Ensure given VPC subnets have zero overlap.
View cidr.py
#!/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 Mar 23, 2018 — forked from kevashcraft/K8s-DigitalOcean-CoreOS.md
How to Setup Kubernetes on DigitalOcean with CoreOS
View K8s-DigitalOcean-CoreOS.md

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
View wtf
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.
View wtf
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.
View gist:10396975
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 Sep 10, 2013
A better variation of AngularJS' ngNumber filter ...
View ngNumber.js
/**
* 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
@wilhelm-murdoch
wilhelm-murdoch / aggregation_test.py
Created Aug 18, 2013
Testing MongoDB aggregation problem. Creates 10 posters and randomly assigns them to 100 posts. Aggregation query returns mapping of poster to latest post sorted by creation date in descending order.
View aggregation_test.py
from pymongo import MongoClient
import datetime
import bunch
from faker import Faker
from random import choice
client = MongoClient(host="localhost", port=27017)
faker = Faker()
posters = []