Skip to content

Instantly share code, notes, and snippets.

View wilrnh's full-sized avatar

William Hutson wilrnh

View GitHub Profile
@wilrnh
wilrnh / setup_encrypted_kubuntu.bash
Created May 8, 2020 16:55
Ubuntu full disk encryption script
#!/bin/bash
# https://help.ubuntu.com/community/Full_Disk_Encryption_Howto_2019
mount | grep efivars
sudo -i
lsblk
export DEV="/dev/nvme0n1"
export DM="${DEV##*/}"
export DM="${DM}$( if [[ "$DM" =~ "nvme" ]]; then echo "p"; fi )"
export ROOT=250G
@wilrnh
wilrnh / keybase.md
Created April 7, 2020 02:11
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@wilrnh
wilrnh / logger.sh
Last active December 5, 2018 16:05
send all output to logger
exec 1> >(logger -s -t $(basename $0)) 2>&1
@wilrnh
wilrnh / gist:1354cb34663bf5b0ec3f5f863c68beea
Created October 17, 2016 20:45
Get the branch name from a git merge commit
git log --format=%s -n1 | sed -n -e 's/^Merge pull request .* from wilrnh\///p'
@wilrnh
wilrnh / gist:d368f9ef6abdf0825352
Created October 27, 2015 21:27
Git originating branch name of latest merge
git log -n1 --format="%D" $(git log --merges -n 1 --format="%P" | awk '{print $2}') | cut -c 8-
@wilrnh
wilrnh / new_gist_file_0
Created July 31, 2015 16:06
Symbolicate iOS crash log
DEVELOPER_DIR=`xcode-select -print-path` /Applications/Xcode.app/Contents/SharedFrameworks/DTDeviceKitBase.framework/Versions/A/Resources/symbolicatecrash /path/to/crash.log /path/to/dsym

GPG for n00bs

Mac OS

# setup gpg
brew install gpg # alternatively, install GPGTools - https://gpgtools.org/
# import your friend's public key
gpg --recv-keys 55418814 --keyserver pgp.mit.edu
# encrypt your stuff
gpg --encrypt --output secretfile.txt.gpg --recipient 55418814 secretfile.txt
# mail it with love
#!/usr/bin/perl -w
# recover rsyslog disk queue index (.qi) from queue files (.nnnnnnnn).
#
# See:
# runtime/queue.c: qqueuePersist()
# runtime/queue.c: qqueueTryLoadPersistedInfo()
#
# kaiwang.chen@gmail.com 2012-03-14
#
use strict;
@wilrnh
wilrnh / mk-ebs.sh
Last active January 1, 2016 20:49
Build EBS vols and tag em and attach em
#!/bin/bash -ex
for i in {f..m}; do
VOLID=$(aws ec2 create-volume --availability-zone us-east-1a --iops 1000 --size 640 --volume-type io1 | grep -o vol-\\\w\\+)
aws ec2 create-tags --resources $VOLID --tags Key=Name,Value=xxxxxxxx
aws ec2 attach-volume --device /dev/sd${i} --instance-id i-xxxxxxxx --volume-id $VOLID
done
@wilrnh
wilrnh / gist:5534380
Last active December 17, 2015 02:19
Script to create a ton of EBS volumes (eg for a RAID setup); requires awscli available from pip
for i in {1..8}; do aws ec2 create-volume --availability-zone us-east-1d --size 128 --output text >> _disks; done
(i=0; for d in `awk '{print $4}' _disks`; do i=$((i + 1)); aws ec2 create-tags --resources ${d} --tags '{"key":"Name", "value": "_disks"}'; aws ec2 attach-volume --instance-id i-xxxxxxxx --volume-id ${d} --device /dev/sdg${i}; done)