Skip to content

Instantly share code, notes, and snippets.

View rosmo's full-sized avatar

Taneli Leppä rosmo

View GitHub Profile
@rosmo
rosmo / delete-vpc.sh
Last active November 15, 2021 12:24
Deleting AWS default VPCs (except for one region) via CLI
delete_vpc_components() {
echo aws ec2 "describe-${7}" --filters "Name=$4,Values=$3" --output text --query "*[*].$5" --region $1
for id in $(aws ec2 "describe-${7}" --filters "Name=$4,Values=$3" --output text --query "*[*].$5" --region $1)
do
echo "Deleting $2: $id"
if [ "$2" == "internet-gateway" ] ; then
aws ec2 detach-internet-gateway $6 $id --vpc-id $3 --region $1
fi
aws ec2 "delete-${2}" $6 $id --region $1
done
#!/usr/bin/python
#
# Convert a Row-Based-Replication binary log to Statement-Based-Replication format, cheating a little.
#
# Additional added some code to transfer INSERT clauses to proper column names.
#
# Usage: mysqlbinlog -v --base64-output=DECODE-ROWS $log | python binlog-rbr-to-sbr.py -hHOST -uUSERNAME -pPASSWORD - | grep -B 1 '^INSERT '
# Based on: https://gist.github.com/shlomi-noach/cc243fd690403e7617e3
#