Skip to content

Instantly share code, notes, and snippets.

@agarstang
agarstang / template.sh
Created March 13, 2017 22:17
Bash base template
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
#/ Usage:
#/ Description:
#/ Examples:
#/ Options:
#/ --help: Display this help message
usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; }
@agarstang
agarstang / userdata_mounts.sh
Created February 27, 2017 15:26
Bash UserData format additional disks
for device in $(lsblk -ln -o NAME | grep -Ev '^xvda\d*')
do
blkdevice="/dev/$device"
echo "Removing any pre-existing mount points for $blkdevice"
umount -f $blkdevice
sed -i "/^\/dev\/$device/d" /etc/fstab
echo "Checking if $blkdevice is formatted.."
/sbin/blkid -t TYPE=ext4 $blkdevice || (echo "Formatting $blkdevice" && /sbin/mkfs.ext4 $blkdevice)
done
@agarstang
agarstang / Debug.txt
Last active July 22, 2016 08:52
Terraform AWS Token Issue
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: 2016/07/22 08:29:03 [INFO] AWS EC2 instance detected via default metadata API endpoint, EC2RoleProvider added to the auth chain
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: 2016/07/22 08:29:03 [INFO] AWS Auth provider used: "EnvProvider"
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: 2016/07/22 08:29:03 [INFO] Initializing IAM Connection
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: 2016/07/22 08:29:03 [INFO] Initializing STS connection
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: 2016/07/22 08:29:03 [DEBUG] [aws-sdk-go] DEBUG: Request iam/GetUser Details:
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: ---[ REQUEST POST-SIGN ]-----------------------------
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: POST / HTTP/1.1
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: Host: iam.amazonaws.com
2016/07/22 08:29:03 [DEBUG] terraform-provider-aws.exe: User-Agent: terraform/0.6.16 () aws-sdk-go/1.1
@agarstang
agarstang / list_certs.sh
Last active February 23, 2016 15:54
Puppet - helper scripts
#!/bin/bash
#List all certs that have been signed that are not myself (useful for cleanup)
ls "`puppet config print ssldir`/ca/signed" | grep -vE "`puppet config print certname`|`puppet config print certname --section master`" | sed "s/.pem//"
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com