Skip to content

Instantly share code, notes, and snippets.

View cobusbernard's full-sized avatar

Cobus Bernard cobusbernard

View GitHub Profile
# Organising a meetup
## Day considerations
- Avoid the first Thursday of the Month
- If we host at Takealot, remember that they have Drinkalot on Thursday
## Sponsors
Sponsors to list:
- Venue
- Drinks
// CDK Commands:
cdk init app --language typescript
npm i @aws-cdk/aws-ec2 @aws-cdk/aws-iam @aws-cdk/aws-s3-assets cdk-ec2-key-pair @aws-cdk/aws-s3 @aws-cdk/aws-sagemaker
Uncomment line 14 in bin/<your app>.ts:
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },
cdk bootstrap
cdk deploy
function get-tfstate() {
if [ -z $1 ]; then
echo "You must specify the environment!"
return
fi
if [ -z $2 ]; then
echo "You must specify the system!"
return
fi

Keybase proof

I hereby claim:

  • I am cobusbernard on github.
  • I am cobus (https://keybase.io/cobus) on keybase.
  • I have a public key whose fingerprint is 7613 BCD0 EF4B 6D32 0C58 AFF3 8656 F0F5 3A9D 5DF9

To claim this, I am signing this object:

@cobusbernard
cobusbernard / packer-version.sh
Created December 1, 2016 06:26
packer-update
function packer-version() {
if [ -z $1 ]; then
echo "You must specify the version!"
return
fi
echo "Switching to packer version $1"
if [ ! -f /usr/local/Cellar/packer/$1/packer ]; then
echo "New version of packer, downloading..."
curl -S https://releases.hashicorp.com/packer/$1/packer_$1_darwin_amd64.zip > /tmp/packer_$1.zip \
&& cd /tmp \
@cobusbernard
cobusbernard / tf-version.sh
Last active July 24, 2020 15:52
Terraform update bash script
function tf-version() {
if [ -z $1 ]; then
echo "You must specify the version!"
return
fi
echo "Switching to terraform version $1"
if [ ! -f /usr/local/Cellar/terraform/$1/terraform ]; then
echo "New version of terraform, downloading..."
curl -S https://releases.hashicorp.com/terraform/$1/terraform_$1_darwin_amd64.zip > /tmp/tf_$1.zip \
&& cd /tmp \
@cobusbernard
cobusbernard / crash.log
Created September 8, 2016 05:21
Terraform 0.7.3 list output crash
This file has been truncated, but you can view the full file.
2016/09/07 21:52:56 [INFO] Terraform version: 0.7.3 0dd7c657d6d60d2e7392b66ae6f74fb84582cab9
2016/09/07 21:52:56 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.7.3/terraform", "plan", "-var", "environment=staging", "-var-file=../env.staging.tfvars", "-var-file=_staging/environment.tfvars", "-out=_staging/proposed.plan"}
2016/09/07 21:52:56 [DEBUG] Detected home directory from env var: /Users/mindless
2016/09/07 21:52:56 [DEBUG] Detected home directory from env var: /Users/mindless
2016/09/07 21:52:56 [DEBUG] Attempting to open CLI config file: /Users/mindless/.terraformrc
2016/09/07 21:52:56 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/07 21:52:56 [DEBUG] Detected home directory from env var: /Users/mindless
2016/09/07 21:52:56 [TRACE] Preserving existing state lineage "2bac8445-a087-48f1-bb42-96529b3d5a5b"
2016/09/07 21:52:56 [TRACE] Preserving existing state lineage "2bac8445-a087-48f1-bb42-96529b3d5a5b"
2016/09/07 21:52:57 [WARN] Ignoring AWS metadata API endpoint at defaul
1) if you’re on (most modern distributions of) linux, forget that `route(1)` even exists (and throw `ifconfig` out in the same go) because it’s just absolutely frustrating. for probably 98% of what you need, `ip(1)` is the cool you care about
generally speaking, these will cover you: `ip route`, `ip address`, `ip link`
2) when dealing with routing problems (​*even if just two hosts next to each other*​), `mtr` > `traceroute` > `ping` is an order that’s useful for a lot of what you need
mtr is nice because you can just let it keep running. press `d` in its display to get a running history breakdown of packets. fantastic for intermittent issues!
traceroute is generally known already, but depending on the complexity of your networks in question you may want `traceroute-nanog` or similar other ones. some of these are ASN-aware, which is useful.
in the same breath as traceroute, something else that’s useful to know about is `tracepath`
it’s a little bit nicer on finding asymm paths
lastly, `ping` ​*is*​ still usef
docker inspect -f='{{range .Config.Env}}{{println .}}{{end}}' b70992b3b65c
docker-compose -f ~ec2-user/docker-compose.yml kill && docker-compose -f ~ec2-user/docker-compose.yml rm --force && docker-compose -f ~ec2-user/docker-compose.yml up -d
# https://github.com/spotify/docker-gc
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes