Skip to content

Instantly share code, notes, and snippets.

View electrawn's full-sized avatar

Jason Potkanski electrawn

  • Undisclosed
  • Chicago
View GitHub Profile
@electrawn
electrawn / packer-ami-id
Last active January 5, 2023 23:14 — forked from danrigsby/packer-ami-id
Get AMI ID from a packer build
#!/bin/bash
#
#Machine Readable Technique to get AMI_ID, tee forwards stdout to stderr.
#
#AMI_ID=`packer build -machine-readable packer.json | tee >(cat 1>&2) | awk -F, '$0 ~/artifact,0,id/ {print $6}'`
#
#Human readable format sends stdout to stderr, awk catches the AMI_ID. This allows output to end up in a jenkins/bamboo output.
# The output of the AWS builder ends with region: ami-id, So rather than have awk read the whole line... we target column 2.
#
AMI_ID=`packer build packer.json | tee >(cat 1>&2) | awk 'match($2, /ami-.*/) { print substr($2, RSTART, RLENGTH) }'`
@electrawn
electrawn / wordpress-ab.sh
Last active March 16, 2022 10:29 — forked from brentertz/ab.sh
Wordpress logged in user performance test with apache bench
#!/bin/bash
# For cygwin, APACHEBENCH could be /usr/sbin/ab2, else ab will suffice on linux/unix systems.
APACHEBENCH=ab
COOKIE_JAR="ab-cookie-jar"
USERNAME="foo@bar.com"
PASSWORD="password"
HOST="127.0.0.1"
BASEURL="http://$host"
LOGINURL="$baseurl/wp-login.php"