Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ

Enrico Stahn estahn

👨‍💻
ʕʘ̅͜ʘ̅ʔ – ʕ•̫͡•ʕ*̫͡*ʕ•͓͡•ʔ-̫͡-ʕ•̫͡•ʔ
View GitHub Profile
@estahn
estahn / domains.py
Last active Sep 13, 2020
Export AWS Route53 Domains to a CSV for Excel people
View domains.py
# Export AWS Route53 Domains to a CSV for Excel people
#
# Usage:
#
# python3 <(wget -q -O - https://gist.github.com/estahn/33ee9f0ecede6416a168489a7a24ee24/raw/5eef9122e573ff23bcd40732856565c37c708efd/domains.py)
#
from itertools import chain, starmap
import pandas as pd
from pandas.io.json import json_normalize #package for flattening json in pandas df
@estahn
estahn / rds-init.sh
Last active Jul 23, 2020
A workaround to get all data loaded into AWS RDS MySQL. When a read replica is restored from a snapshot, the replica won't wait for all the data to be transferred from Amazon Simple Storage Service (Amazon S3) to the Amazon Elastic Block Store (Amazon EBS) volume that's associated with the replica DB instance. The replica DB instance is availabl…
View rds-init.sh
#!/bin/bash
host=$1
user=$2
password=$3
echo '' > $0.queue
databases=$(mysql -h $host -u $user -p$password -e "show databases" -sN | grep -v information_schema | grep -v mysql | grep -v sys)
for database in $databases; do
for table in $(mysql -h $host -u $user -p"$password" -N -B -e "show tables from \`$database\`"); do
@estahn
estahn / aws-iam-delete-user.sh
Last active Oct 9, 2019
A script to delete AWS IAM users programmatically.
View aws-iam-delete-user.sh
#!/usr/bin/env bash
_process_user() {
_detach_policies $1 &
_delete_access_keys $1 &
wait
_delete_user $1 &
}
_detach_policies() {
View resource-labels.rego
package test
passed { not deny }
deny {
not input.metadata.labels.customer
}
View keybase.md

Keybase proof

I hereby claim:

  • I am estahn on github.
  • I am estahn (https://keybase.io/estahn) on keybase.
  • I have a public key ASC2Q8Hprpg4hYZylH_pXmBCVxFxZif6J5JqVOWf0CYHPwo

To claim this, I am signing this object:

View kubectl-update
#!/bin/sh
KUBECTL=$(which kubectl)
echo "CURRENT VERSION:"
kubectl version
echo ""
curl -o ${KUBECTL} -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
chmod 755 ${KUBECTL}
@estahn
estahn / metabase.service
Last active Jun 3, 2019
Systemd file for Metabase
View metabase.service
[Unit]
Description=Metabase server
After=syslog.target
After=network.target
[Service]
WorkingDirectory=/home/data/tools/metabase
ExecStart=/usr/bin/java -jar /home/data/tools/metabase/metabase.jar
Environment=MB_JETTY_PORT=8080
User=data
@estahn
estahn / create.js
Last active May 19, 2017
lambda-formation Custom::Route53::HostedZone
View create.js
var handler = require('lambda-formation').resource.create;
var util = require('lambda-formation').util;
var aws = require("aws-sdk");
var uuidV4 = require('uuid/v4');
/**
* Creates a Hosted Zone and supports delegation sets
*
* Type: "AWS::Route53::HostedZone"
* Properties:
View domain01.yml
---
AWSTemplateFormatVersion: '2010-09-09'
Metadata:
Version: 1
LastUpdated: 2017-05-16 16:58:35
UpdatedBy: estahn
Comments: Generated by cfn-ansible
Description: >
View create.js
var handler = require('lambda-formation').resource.create;
var util = require('lambda-formation').util;
var aws = require("aws-sdk");
/**
* Creates a Hosted Zone and supports delegation sets
*
* Type: "AWS::Route53::HostedZone"
* Properties:
* DelegationSetId: <Your delegation set id>
You can’t perform that action at this time.