Skip to content

Instantly share code, notes, and snippets.

Avatar

Adam Ward atward

  • Melbourne, Australia
View GitHub Profile
@atward
atward / example-gcp-lb-http2.tf
Last active Apr 1, 2021
Example Terraform GCP Global HTTP LB with HTTP/2 backend instance group
View example-gcp-lb-http2.tf
module "http_lb" {
source = "GoogleCloudPlatform/lb-http/google"
version = "~> 4.5"
project = var.project_id
name = "demo"
http_forward = false
ssl = true
private_key = tls_private_key.example.private_key_pem
@atward
atward / example-dev-memcache.tf
Created Mar 12, 2021
Example Terraform GCP org with Memcache in service project
View example-dev-memcache.tf
# add memcache (Memorystore) example to development
resource "google_memcache_instance" "cache_dev" {
provider = google-beta
project = google_project.development.project_id
name = "cache-dev"
region = var.region
authorized_network = google_service_networking_connection.private_service_connection.network
node_config {
cpu_count = 1
View .git-prompt-colors.sh
# theme based off https://github.com/magicmonty/bash-git-prompt/blob/a2182bb646987ebca978a655a5deb18bcc65dbe1/themes/Single_line_Solarized.bgptheme
define_helpers() {
:
}
# Get git relative path
function prompt_callback {
if [[ -e "$repo" ]]; then
GitBaseName="${repo##*/}"
@atward
atward / fix_terragrunt_state.py
Created May 1, 2019
Attempts to fix inconsistencies with terragrunt local tfstate, s3 backend state and dynamodb lock state
View fix_terragrunt_state.py
#!/usr/bin/env python3
import os
import json
from pprint import pprint
import boto3
@atward
atward / safeget.py
Created May 1, 2019 — forked from WTFox/safeget.py
Perfect for handling nested dictionaries where values might not exist.
View safeget.py
def safeget(dct, *keys):
dct = dict(dct)
for key in keys:
try:
dct = dct[key]
except (KeyError, AttributeError, TypeError) as e:
return None
return dct
@atward
atward / github_get
Created Mar 5, 2019
Script to download asset file from tag release using GitHub API v3
View github_get
#!/usr/bin/env bash
# Script to download asset file from tag release using GitHub API v3.
# See: http://stackoverflow.com/a/35688093/55075
# Check dependencies.
set -e
type curl grep sed tr >&2
# Validate settings.
[ "$GITHUB_API_TOKEN" ] || { echo "Error: Please define GITHUB_API_TOKEN variable." >&2; exit 1; }
View keybase.md

Keybase proof

I hereby claim:

  • I am atward on github.
  • I am atward (https://keybase.io/atward) on keybase.
  • I have a public key whose fingerprint is DCF7 1D93 BE2C E24D CC64 62AD 5795 E6B4 8B33 50F2

To claim this, I am signing this object:

@atward
atward / gist:ca414f25627ceddc62de77532e8270f2
Created Jul 11, 2018
Jenkins scan config & generate stages
View gist:ca414f25627ceddc62de77532e8270f2
def jobs = ["JobA", "JobB", "JobC"]
def parallelStagesMap = jobs.collectEntries {
["${it}" : generateStage(it)]
}
def generateStage(job) {
return {
stage("stage: ${job}") {
@atward
atward / WinMove.ahk
Created Apr 8, 2018
Script to allow positioning of windows based on quadrants of the current monitor
View WinMove.ahk
; Script to allow positioning of windows based on quadrants of the current monitor
; https://autohotkey.com/board/topic/108780-move-window-to-half-quarter-of-current-monitor/
#Backspace::
MoveIt(8)
Return
#\::
MoveIt(2)
Return
@atward
atward / ONI_Priority_Shortcut.ahk
Last active May 29, 2017
Oxygen Not Included: Priority shortcut keys
View ONI_Priority_Shortcut.ahk
; Oxygen Not included fast priority keybindings.
;
; Instructions:
; - start ahk script
; - start game
; - hit q, wait bit to scan UI
; - use numbers as priorities
;
; Original credits:
; https://www.reddit.com/r/Oxygennotincluded/comments/5vw1us/tired_of_clicking_a_priority_use_autohotkey_to/de8fgnt/