Skip to content

Instantly share code, notes, and snippets.

View djmetzle's full-sized avatar
⚙️
Working

Daryl Metzler djmetzle

⚙️
Working
View GitHub Profile
@djmetzle
djmetzle / yaml-to-json.rb
Created March 14, 2019 20:20
YAML to JSON Converter
require 'yaml'
require 'json'
x = <<-HEREDOC
---
some:
- yaml: foo
here: bar
HEREDOC
@djmetzle
djmetzle / recaman.rb
Created July 1, 2018 02:15
Recaman Sequence Generator
#!/usr/bin/ruby
# Recaman Sequence Generator
HIEGHT=2160
WIDTH=3840
SVG_PREAMBLE = <<~HEREDOC
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
@djmetzle
djmetzle / checks3logging.sh
Created May 1, 2018 22:24
Quick Script to find S3 buckets with logging enabled
#!/bin/bash -e
# Get list of buckets
S3_BUCKETS=( `aws s3api list-buckets --query "Buckets[].Name" --output=text` )
for bucket in "${S3_BUCKETS[@]}"; do
BUCKET_LOGGING=`aws s3api get-bucket-logging --bucket $bucket`
if [ -n "$BUCKET_LOGGING" ]; then
echo "$bucket: $BUCKET_LOGGING"
fi
@djmetzle
djmetzle / eni.md
Created December 18, 2017 16:52
Steal ENI Blogpost?

Attach an ENI to a Fedora/Red Hat/CentOS Instance

aws ec2 attach-network-interface \      
   --region $AWS_REGION \               
   --instance-id $INSTANCE_ID \         
   --device-index 1 \                   
   --network-interface-id $ONLINE_ENI_ID
@djmetzle
djmetzle / steal-eni.sh
Created December 16, 2017 18:17
Steal an ENI for a Fedora/RedHat/CentOS Instance
#!/bin/bash -ex
# Steal an ENI
# (uses "ONLINE_ENI_ID" from the environment)
# Get some instance basics
METADATA_ENDPOINT="http://169.254.169.254/latest/dynamic/instance-identity/document"
AWS_REGION=`curl -s $METADATA_ENDPOINT | jq .region -r`
INSTANCE_ID=`curl -s http://169.254.169.254/latest/meta-data/instance-id`