Skip to content

Instantly share code, notes, and snippets.

@RulerOf
RulerOf / keybase.md
Created October 24, 2017 19:46
Keybase Proof

Keybase proof

I hereby claim:

  • I am rulerof on github.
  • I am abobulsky (https://keybase.io/abobulsky) on keybase.
  • I have a public key ASCjqjneTXV6VZmalCQiZ4Crnvsd6dAqjlhF2KH71wHElAo

To claim this, I am signing this object:

@RulerOf
RulerOf / bash-delete-iam.sh
Last active January 14, 2018 10:27
Bash to delete an IAM user (missing Certificate removal and MFA removal)
# Set a user to delete
targetUser = ThisGuy
# Set the name of our awscli profile
aws_profile = prod
# Get all the keys that the user has on its account
userKeys=$(aws iam list-access-keys --user-name $targetUser --profile $aws_profile | jq -r '.AccessKeyMetadata[].AccessKeyId')
# Delete the keys
@RulerOf
RulerOf / vbox-install.sh
Created February 21, 2018 15:43
Install or auto-update VirtualBox for Mac OS
#!/usr/bin/env bash
# shellcheck disable=SC2046
# We're catching errors manually here
set +e
# Start off the output formatting for this whole thing
echo "----"
if command -v VBoxManage >/dev/null 2>&1 ; then
@RulerOf
RulerOf / content-engine-update.sh
Last active May 17, 2018 09:52
Short description of service backup setup
#!/bin/bash
# content-engine-update.sh pulls new container images and starts those images
# if there are any updates to be found. The "proper" way to do this is with
# the v2tec/watchtower docker image, but I prefer this method because of the
# logging output I get with this single-host setup
# Get the script name
scriptName="$(basename $0)"
@RulerOf
RulerOf / zfs-on-oracle-linux-7.md
Last active June 7, 2019 19:46
Installing ZFS on Linux on Oracle Linux 7

Installing ZFS on Linux on Oracle Linux 7

We're going to add ZFS support to our Oracle Linux installation. We'll just add the ZFS on Linux Repo, verify the binary signature from GitHub, install the files, ensure the driver loads properly, and verify that it's functional. We'll save things like array creation for another document.

This is mostly a transcription of the process from the CentOS/RHEL ZoL installation manual.

Note

This will install ZFS v0.7 release on OEL 7.7 and earlier, and ZFS 0.8 on OEL 7.8 and later.

Install the repo file

@RulerOf
RulerOf / example.tf
Created August 12, 2019 23:01
Turning two lists of maps into a single map output
variable "map1" {
default = [
{
name = "map1name1",
default_ip_address = "map1addr1"
},
{
name = "map1name2",
default_ip_address = "map1addr2"
}
@RulerOf
RulerOf / arn_parse.rb
Last active January 31, 2020 20:58
Parse an AWS ARN with Ruby
class Arn
attr_accessor :partition
attr_accessor :service
attr_accessor :region
attr_accessor :account
attr_accessor :resource
def initialize(partition, service, region, account, resource)
@partition = partition
@service = service
@RulerOf
RulerOf / README.md
Created June 30, 2020 01:48
Bookmarklet to make a youtube video fill the window

Use the minified code inside of a bookmarklet. You can test it directly in your browser console on any YouTube video page. It ought to work anywhere but was only tested in Chrome 83.

When you're on a YouTube page, click the bookmarklet and it'll take you to the embedded version of the player that fills the entire window without requiring you to go to full screen mode. This is particularly useful if you have a 16:10 monitor.

The non-minified code is included as a reference to show how it works. There are other window-filling bookmarklets out there. I made this one because I wanted to write it.

@RulerOf
RulerOf / creating-zfs-pool-on-zol.md
Last active October 7, 2020 01:30
Setting up a 20-disk raidz3 with Fusion io ZIL and cache with ZoL on Oracle Linux 7

Creating a raidz3 pool with Fusion io SLOG and L2ARC cache

Using the following hardware:

  • 23 3TB Hitachi Ultrastar disks
  • 2 640GB Fusion io ioDrive Duo cards, each with 2 separate storage devices on them

The plan is to create a RAIDz3 zpool with 20 disks in the array, 3 hot spares, a mirrored log device containing one drive from each of the ioDrives, and two cache devices made out of the remaining ioDrives. We'll also underprovision the ioDrives to help with wear leveling, since 320GB ZIL and 640GB cache are excessive for this setup.

Underprovision the ioDrives

@RulerOf
RulerOf / README.md
Created March 31, 2021 13:44
DNS SRV Records with Terraform

DNS SRV with Terraform (On AWS Route53)

DNS SRV records are a little cryptic. Even when you create them, it's not particularly obvious what the information in the SRV record actaully means.

When creating the records with Terraform, you can for_each the resource to supply one or more maps that contain better descriptors of the SRV record's constituent components. See the example in the terraform snippet below. Refer here for a longer explanation.