Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/bash
#
# If an EC2 Instance tag Name matches a record in DNS (Route53) and the EC2 Instance is removed without Tidying Route53 Zone,
# This script will find the "orphaned" Zone records, and remove them.
#
rm -f /tmp/delete-r53.json
ZONEID=$(aws route53 list-hosted-zones-by-name |jq -r '.HostedZones[]|select (.Config.PrivateZone)|select (.Name|contains("example.com"))|.Id')
#
# Get a list of all DNS Records which don't have a running instance
#
@blofeldthefish
blofeldthefish / #running docker in docker on a Mac
Last active September 2, 2025 12:54
Running Docker in Docker (dind) on a Mac
# execute on Mac to create services:
docker-compose up -d
# "login" to client container:
docker exec -it my-docker-client sh
# within client container:
/ # docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
@blofeldthefish
blofeldthefish / cfnflip2cfndsl
Created October 11, 2024 04:45
Take the rubified output from cfnflip, and turn into a cfndsl definition
# Does most of the heavy listing to convert from "rubified" output from cfnflip.com website, in a cfndsl ruby definition
# Still a few quirks, which require manual edits.
cat ${1} | sed -z -E 's/Resource\("([^"]+)"\)(\s*do\s*)Type\("((AWS::)?([A-Za-z0-9]+)::([A-Za-z0-9]+)"\))/\5_\6(:\1) do/g' | \
sed -E 's/Property\("([A-Za-z0-9_]+)",\s*([\[{]|".*?"|[A-Za-z0-9_]+\s*\([^()]*\))?\s*\)?\s*/\1 \2/' | \
sed -E 's/("([^"]+)")(\s*)=>/\2:/' | \
sed 's/})/}/' | \
sed 's/])/]/' | \
sed 's/"/'"'"'/g'