Skip to content

Instantly share code, notes, and snippets.

@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'
@blofeldthefish
blofeldthefish / #running docker in docker on a Mac
Last active April 1, 2024 01:11
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
#!/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 / BigInt.jq
Created April 7, 2020 12:59 — forked from pkoppstein/BigInt.jq
BigInt library of functions for jq
# Copyright (c) 2014-2015 Peter Koppstein (pkoppstein at gmail dot com) 2015.05.02
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@blofeldthefish
blofeldthefish / Replace-RDGatewayCertificate.ps1
Created February 20, 2020 21:54 — forked from rhymeswithmogul/Replace-RDGatewayCertificate.ps1
A post-renewal script for Certify that replaces the Remote Desktop Gateway certificate.
<#
Replace-RDGatewayCertificate.ps1
Version 1.0.1 -- fixed my bad grammar
by Colin Cogle <[email protected]>
This program is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation, either
version 3 of the License. This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
version: '3'
services:
bitbucket:
image: "atlassian/bitbucket-server:5.0"
container_name: bitbucket
restart: always
ports:
- "7990:7990"
- "7999:7999"
environment:
@blofeldthefish
blofeldthefish / install.sh
Created March 5, 2019 07:24 — forked from mkubenka/install.sh
OpenVPN Access Server Letsencrypt
#!/bin/sh
apt-get -y install git bc
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
mkdir /etc/letsencrypt
@blofeldthefish
blofeldthefish / tag-vols-snaps.py
Created January 9, 2019 06:39
Automatically tag EC2 snapshots and volumes based on their attached AMIs/Instances
#!/usr/bin/python
# most credit to the original: https://gist.github.com/brandond/6b4d22eaefbd66895f230f68f27ee586
# additional credit to some modification: https://gist.github.com/danpritts/1089d878a76b14393478a7476476f97b
# Uncomment to RUN FOR REAL!!
#DEBUG = False
# Tag snapshots based on their associated AMI and volumes based on attached instance.
# format:
# (AMI:db5|db5) /dev/sda1 (1/4)
@blofeldthefish
blofeldthefish / git-delete-history.sh
Created September 10, 2018 07:57 — forked from deiu/git-delete-history.sh
Script to permanently remove files/folders from your Git history.
#!/bin/bash
# Script to permanently remove files/folders from your git history. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
set -o errexit
if [ $# -eq 0 ]; then
echo "Usage: $0 file1 file2"
echo " or: $0 path1 path2"
@blofeldthefish
blofeldthefish / White label Route 53 nameservers.md
Created August 23, 2018 19:42
AWS Route 53 white label nameserver setup