Skip to content

Instantly share code, notes, and snippets.

View keenan-v1's full-sized avatar
🐺
Awoo!

Jonathan Walker (Keenan) keenan-v1

🐺
Awoo!
View GitHub Profile
@keenan-v1
keenan-v1 / provision-ebs.sh
Last active May 2, 2020 16:56
EBS provisioning script
#!/usr/bin/env bash
DEFAULT_FILESYSTEM='ext4'
for DEVICE in $(lsblk -lnd -o NAME | grep -v nvme0); do
VOLUME_ID=$(ebsnvme-id /dev/$DEVICE -v | cut -d' ' -f3)
MOUNT_POINT=$(aws ec2 describe-volumes --volume-id $VOLUME_ID | jq -r '.Volumes | .[].Tags | .[] | select(.Key == "MountPoint") | .Value')
echo "Device: ${DEVICE} - ${MOUNT_POINT}"
# Wait for attachment
aws ec2 wait volume-in-use --volume-ids $VOLUME_ID --filters Name=attachment.status,Values=attached
if [[ $(file -s /dev/$DEVICE | cut -d':' -f2) == " data" ]]; then
echo "Creating ext4 filesystem on /dev/$DEVICE."
@keenan-v1
keenan-v1 / le-auth-hook.sh
Last active May 2, 2020 17:15
LetsEncrypt AWS Route53 Auth Hook
# From https://gist.github.com/li0nel/6cae382947e2d1f13ad594a1ef04f7cf
#!/usr/bin/env bash
#!/usr/bin/env bash
aws route53 wait resource-record-sets-changed --id \
$(aws route53 change-resource-record-sets --hosted-zone-id \
"$(aws route53 list-hosted-zones-by-name --dns-name $2. \
--query HostedZones[0].Id --output text)" \
--query ChangeInfo.Id \
--output text \
--change-batch "{ \
@keenan-v1
keenan-v1 / hello.lua
Created October 5, 2019 15:35
Learning lua in an odd way
print("Hello World")
go_print("Hello from Go inside Lua")
print(test_str)
@keenan-v1
keenan-v1 / ebsnvme-id
Last active March 16, 2021 16:09 — forked from lbernail/ebsnvme-id
ebsnvme-id script
#!/usr/bin/env python2.7
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
@keenan-v1
keenan-v1 / recipeschema.json
Created December 2, 2016 23:19
Recipe Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Recipes",
"type": "array",
"items": {
"title": "Recipe",
"type": "object",
"properties": {
"name": {
"type":"string"
@keenan-v1
keenan-v1 / recipe 1367.json
Created November 28, 2016 18:25
Casserole Recipe (WU)
{
"name":"casserole (herb)",
"recipeid":"1367",
"known":true,
"skill":"hot food cooking",
"trigger":"heat",
"cookers":[
{"id":"oven"},
{"id":"campfire","difficulty":5},
{"id":"forge","difficulty":10}
@keenan-v1
keenan-v1 / sort.go
Last active August 12, 2016 14:40
Sorting (Merge Sort vs Insertion Sort)
package sort
func mergeSort(arr []int) (c []int) {
sz := len(arr)
if sz <= 1 {
return arr
}
s := int(sz / 2)
a, b := arr[:s], arr[s:]
la, lb := len(a), len(b)