Skip to content

Instantly share code, notes, and snippets.

View qrkourier's full-sized avatar

Kenneth Bingham qrkourier

View GitHub Profile
@qrkourier
qrkourier / 0_reuse_code.js
Created February 1, 2014 03:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am qrkourier on github.
  • I am kourier (https://keybase.io/kourier) on keybase.
  • I have a public key whose fingerprint is 5489 E13F 8105 64DF 47FB 9841 B694 03FA 957C 5E46

To claim this, I am signing this object:

#!/bin/bash -eu
git filter-branch --env-filter '
# name, email, and date for author and committer are all set to the preferred
# values unless the override variable is empty or undefined.
# (see git-rewrite-tree(1))
#GIT_AUTHOR_NAME
#GIT_AUTHOR_EMAIL
#GIT_AUTHOR_DATE
@qrkourier
qrkourier / equivalentdomains_stackexchange.rb
Last active December 3, 2016 05:12
find equivalent domain names for the Stack Exchange network of sites for LastPass account settings
#!/usr/bin/env ruby
#
# [this lives here now](https://github.com/qrkourier/stackdom/blob/master/bin/stackdom.rb)
#
# slurp some XML over HTTP and parse to find equivalent domain
# names for the Stack Exchange network of sites
#
# shell $ gem install xml-simple domainatrix
#
@qrkourier
qrkourier / shufpad.sh
Last active December 3, 2016 05:12
Shuffle, pad with a random duration of silence, and concatenate a bunch of .mp3 files
#!/bin/bash -u
#
# [this lives here now](https://github.com/qrkourier/shufflepad-sound-machine/blob/master/bin/shufflepad.sh)
donames(){
find -mindepth 1 -maxdepth 1 -type f -iname '*.mp3' | egrep '\s' | \
while read pad;do
mv -v "$pad" $(sed -r 's/[-)(_ ]+//g'<<<"${pad#./}")
done
}
#!/usr/bin/env python
#
# @qrkourier (2017)
#
# print the estimated USD yield for a given Ethermine API URL
#
# $ ethermine-yield.py https://ethermine.org/api/miner_new/9a0C4548c8b827e01aF1dc3AF9373830
# $1.28/day
# $8.97/week
# $38.99/month
@qrkourier
qrkourier / docker-compose.yml
Last active November 13, 2017 16:40
put metrics in Elasticsearch from the Nicehash API and the Nvidia driver (e.g., GPU temperature)
version: '3.2'
services:
elasticsearch:
image: "docker.elastic.co/elasticsearch/elasticsearch:5.5.2"
environment:
- http.host=0.0.0.0
- transport.host=127.0.0.1
@qrkourier
qrkourier / rollRdsCa.sh
Last active March 5, 2020 01:38
roll RDS instance CAs and bounce immediately
#!/bin/bash
set -e -u -o pipefail
aws --output text ec2 describe-regions | while read REG ENDPOINT OPT REGION; do
aws --region $REGION rds describe-db-instances | \
jq -r '[.DBInstances[]|select(.CACertificateIdentifier == "rds-ca-2015")|{id:.DBInstanceIdentifier, az:.AvailabilityZone,engine:.Engine, user:.MasterUsername, end:.Endpoint.Address}]'
done
read -p "Roll cert and bounce these instances? <ENTER> to proceed, Ctrl-c to cancel: "
@qrkourier
qrkourier / export-netfoundry-api-token.bash
Last active May 23, 2020 13:46
source this file to make NETFOUNDRY_API_TOKEN available to child processes
# source this file in bash or zsh to make
# NETFOUNDRY_API_TOKEN
# available to processes run in the same shell
_get_nf_token(){
[[ $# -eq 2 ]] || {
echo "ERROR: send two params: client_id client_secret" >&2
return 1
}
client_id=$1
# 1) define one or more Restic repo paths
typeset -A RESTIC_REPOS
RESTIC_REPOS[gdrive]=rclone:gdrive-backup:
RESTIC_REPOS[KX1T]=/media/kbingham/KX1T/backups
#RESTIC_REPOS[bigExternalDrive]=/media/kbingham/bigExternalDrive/backups
# 2) create an exclude file with lines like:
# **/*cache/