Skip to content

Instantly share code, notes, and snippets.

Avatar

Dave Kerr dwmkerr

View GitHub Profile
@dwmkerr
dwmkerr / terraform-best-practicess.md
Created Dec 12, 2018
Notes on best practices for Terraform modules
View terraform-best-practicess.md

(Disclaimer: work in progress!)

Consistent usage of count

Place count consistently in modules. count dramatically changes how a client will reason about a resource, so make it very clear what resources are dynamic.

@dwmkerr
dwmkerr / gpr.sh
Created Oct 9, 2018
A shell command to push and open a pull request. Tested on OSX/Ubuntu. No dependencies.
View gpr.sh
#!/usr/bin/env bash
# gpr - push the current branch to origin and attempt to open the Create Pull
# Request or Create Merge Request page if available.
#
# Inspired by: https://gist.github.com/tobiasbueschel/ba385f25432c6b75f63f31eb2edf77b5
# How to get the current branch: https://stackoverflow.com/questions/1593051/how-to-programmatically-determine-the-current-checked-out-git-branch
# How to open the browser: https://stackoverflow.com/questions/3124556/clean-way-to-launch-the-web-browser-from-shell-script
# Colour constants for nicer output.
GREEN='\033[0;32m'
@dwmkerr
dwmkerr / k8s-patch-virtualservice.go
Last active Dec 11, 2019
Example showing how to patch an Istio VirtualService CRDs Golang
View k8s-patch-virtualservice.go
// Example showing how to patch Kubernetes resources.
package main
import (
"encoding/json"
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/dynamic"
@dwmkerr
dwmkerr / k8s-list-virtualservices.go
Created Oct 8, 2018
Example showing how to list Istio VirtualService CRDs Golang
View k8s-list-virtualservices.go
// Example showing how to patch Kubernetes resources.
package main
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/dynamic"
_ "k8s.io/client-go/plugin/pkg/client/auth"
@dwmkerr
dwmkerr / k8s-patch.go
Last active Feb 11, 2020
Example showing how to patch Kubernetes resources in Golang. Companion to the article 'https://dwmkerr.com/patching-kubernetes-resources-in-golang/'.
View k8s-patch.go
// Example showing how to patch kubernetes resources.
// This is the companion to my article 'Patching Kubernetes Resources in Golang':
// https://dwmkerr.com/patching-kubernetes-resources-in-golang/
package main
import (
"encoding/json"
"fmt"
types "k8s.io/apimachinery/pkg/types"
@dwmkerr
dwmkerr / availability_zones.tf
Last active Feb 18, 2020
Terraform AWS Regions and Availability Zones
View availability_zones.tf
// Gist: https://gist.github.com/dwmkerr/58bfbf55eb9f05c8603958806add00cc
// Source: https://aws.amazon.com/about-aws/global-infrastructure/
// Updated: 2018-02-27
// Examples:
// 1. Get the second az in singapore:
// "${element(var.aws_availability_zones['ap-southeast-1'], 0)}"
// Availability zones for each region
@dwmkerr
dwmkerr / setup-sublime3-for-angular2.md
Last active Apr 11, 2020
Quickly setup Sublime Text 3 for Angular 2
View setup-sublime3-for-angular2.md

Quick Setup for Sublime Text 3 for Angular 2

Easy to remember, easy to forget.

Step 1: Download Sublime Text 3

Sublime Text 3 Download

Step 2: Create a bash shortcut

It's nice to be able to run subl in a terminal.

You can’t perform that action at this time.