Skip to content

Instantly share code, notes, and snippets.

irgeek /
Last active December 10, 2021 16:42
Finding AMIs after building an image with Packer

Finding Packer-generated AMIs automatically after builds

The basic technique is to have Packer add a tag with a unique value during the build, and use AWS' built-in filtering capabilities to find that specific AMI after the build finishes.

  • template.json - Shows the settings that need to be added to your template
  • - Shows how to use the template to do a build and retrieve the AMI information
irgeek /
Created January 2, 2015 05:08
Shell script (bash) to persist ssh-agent environment variables...
# Bash script to maintain a persistent ssh-agent across multiple
# invocations of your shell when the parent process launching them
# does not set the necessary environment variables.
start_agent() {
chmod 600 ${AGENT_VARS_FILE}
[[ -s ${AGENT_VARS_FILE} ]] && { echo "Resetting agent file failed. Non-zero length!"; exit 1; }
irgeek /
Last active February 19, 2016 01:57
Keybase proof

Keybase proof

I hereby claim:

  • I am irgeek on github.
  • I am irgeek ( on keybase.
  • I have a public key ASDUY2TB580FvHixmDAUwO-oWxA3nWV23WtXPP4HbxTJHwo

To claim this, I am signing this object:

for cert in $(/bin/ls -1 ${BOOT2DOCKER_CERTS_DIR}); do
HASH_FILE=${CERTS_DIR}/$(/usr/local/bin/openssl x509 -noout -hash -in ${SRC_CERT_FILE} 2>/dev/null)
irgeek /
Last active March 2, 2016 05:29
Script to test SSL cipher availability
#_red() { echo '\e[31m'"$1"'\e[m'; }
#_grn() { echo '\e[32m'"$1"'\e[m'; }
#_ylw() { echo '\e[33m'"$1"'\e[m'; }
test_cipher_proto() {
local cipher endpoint proto proto_flag result ret
irgeek /
Created June 3, 2016 04:14
Spiffy calculation on the command line!
spiffy_calc() {
local -a FIRST_ARG
local -a ACC
for var in "$@"; do
if [[ ${var} == "in" ]]; then
irgeek /
Created November 15, 2017 00:15
Australian Marriage Survey Results

Australian Marriage Survey Results

The attached file contains the results of the Australian Marriage Survey in JSON format, scraped from the "Australian Marriage Law Postal Survey 2017 - Response.xls" Excel spreadsheet provided by the ABS here

irgeek / dice.html
Last active September 19, 2018 10:05
<!doctype html>
<title>Dé de Couleurs</title>
<meta name="description" content="Dé de Couleurs">
<meta name="keywords" content="dice colour random">
<meta charset="utf-8">
<style type="text/css" media="screen">
* {
_red() { echo '\[\e[31m\]'"$1"'\[\e[m\]'; }
_grn() { echo '\[\e[32m\]'"$1"'\[\e[m\]'; }
_ylw() { echo '\[\e[33m\]'"$1"'\[\e[m\]'; }
_blu() { echo '\[\e[34m\]'"$1"'\[\e[m\]'; }
_fus() { echo '\[\e[35m\]'"$1"'\[\e[m\]'; }
_cyn() { echo '\[\e[36m\]'"$1"'\[\e[m\]'; }
_wht() { echo '\[\e[37m\]'"$1"'\[\e[m\]'; }
_ppl() { echo '\[\e[38;5;55m\]'"$1"'\[\e[m\]'; }
_lgrn() { echo '\[\e[38;5;84m\]'"$1"'\[\e[m\]'; }
irgeek / Makefile
Last active September 12, 2019 14:40
Minimal test case to show aws-cli cloudformation package regression.
S3_BUCKET := cf-templates-1wwumiwcx5krz-ap-southeast-2
S3_PREFIX := 8b87ca7b-869e-4401-baa0-ad0522e32f21
AWSCLI := .venv/bin/aws
all: parent.pyaml
parent.pyaml: child.pyaml
child.pyaml: grandchild.pyaml