Skip to content

Instantly share code, notes, and snippets.

@derektamsen
derektamsen / 03B4B0BF.pub
Created July 17, 2020 19:32
gpg public key for Derek Tamsen <dtamsen@influxdata.com>
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF8D1WEBEACvX2Y0I5mGpxov1n6e4XLVKYWXSAWdeD9Q3gG0Bwh2Dxg9e/sf
HXbGyv6VIE8OYRaxba998JZyiJv4ZzIr3ti2gNxobiLzlLR32anUjVlhdcFs+4oa
+oIHeL1n8kN8BF2NN9dOaIf4OE0TqIGup/8MZNSaPVkVSZNnM6hc1XWnunpueEC7
gTRuXI001eIBUgprUcqgqKO044VNI6vzCsTC+Act3E+WTOjzTAVLOo3NNjY1N8gD
eMr1ZF8AlAfQO8NrPOkoOQNuFRAfyosKPLPZumDEwuv9zYfQed1312/XFLSklJIq
e5M8/MXYCvN8qOm6gYjgpgNSeqwft12Y7G7TZ/ALTWvIkgQ3yjtk6gYQdiXgBVAl
1BAbXBl8KBq9PkucwUug3sGI/LJni+kycM0wzi3VPxKG3hAeoPDfe2eiTo4ddaCu
uTlEW5k8p3IK7kJUgunH9YVagkEVrY0N/fXwt89G2NtTkUkIxuGSHVnQPTFA2sJD
@derektamsen
derektamsen / Makefile-mermaid
Last active December 25, 2023 07:29
Makefile to render all mermaid diagrams in the directory it is placed in.
src_files := $(wildcard *.mmd)
out_files := $(patsubst %.mmd,output/%.png,$(src_files))
.PHONY: all clean
all: $(out_files)
output/%.png: %.mmd
mkdir -p $(dir $@)
mmdc -c ./mermaidconfig.json \
@derektamsen
derektamsen / update_rdshost_cert_thumbprint.ps1
Created August 22, 2019 21:12
Update Remote Desktop Host Certificate Thumbprint. Used when applying an externally issued machine certificate for use with RDP.
param ($forceY = $false)
import-module pki
function promptContinue {
$input = Read-Host "Would you like to continue? (y/n)"
switch -regex ($input.ToLower()) {
'y(es)?' { return $true }
'n(o)?' { return $false }
@derektamsen
derektamsen / linux-onetime-setup.py
Created August 22, 2019 21:09
Configures a Google Authenticator TOTP in slot 2 on a yubikey for use on linux.
#!/usr/bin/env python
# Ubuntu Installation
# - Install the ubuntu yubico ppa: sudo add-apt-repository ppa:yubico/stable
# - Update your apt cache: sudo apt update
# - Install the package for ykcalresp: sudo apt install yubikey-personalization
# - Copy the secret key below the qr code.
# - Run the gist and enter the secret key when prompted.
import base64
@derektamsen
derektamsen / hooks-pre-commit
Last active September 4, 2016 07:30
Deny commits to tags in a subversion repository via pre-commit hook. http://svnbook.red-bean.com/en/1.7/svn.ref.reposhooks.pre-commit.html
#!/bin/sh
# Save in `hooks/pre-commit` and `chmod +x hooks/pre-commit`
# source: http://stackoverflow.com/a/576261
#
# Denies commits to tags with a pre-commit hook
REPOS="${1}"
TXN="${2}"
SVNLOOK='/usr/bin/svnlook'
@derektamsen
derektamsen / keybase.md
Created January 25, 2016 03:05
I am proving ownership of the github account for https://keybase.io

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@derektamsen
derektamsen / 7ED71D98.pub
Created November 9, 2015 06:17
gpg public key for Derek Tamsen <dtamsen@gmail.com> id 7ED71D98
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQINBFZANQ8BEAC2PGiHlLWi2iCelMPjrVyIZ1onM1BslKU7vk8K1TD+qUbOF2d9
VJQ2ssX4r1n4e9ZPI2XJ5U8IraQQ3+t7f3p2W8Pgm7dCLTwIXGaO/mn1d5s47CVJ
Ud9WG8jnHv3hKrg+Ty3cb69jXFo02WYEvLC314ptJtnM1mDagveh4HoCuQXbpk30
GKaOVGU2rLnZP3ip+etOA2Wym2zCkMa9uCRhSeQeQ0YzAfKeRvVrfSjilpRR6v37
el6i1XO6cp/Ugzie8mo3+UHGwvnKsf3nmtOJaejtbw8FpRI6JwH/dFLjSWlrMdIU
51mRq+naNdRkXlUGZmvHT3eOAqt+78+I1DbN55BYOuPDGtO55Oa/ma4/IVWDcc/v
9oKURLv6LAQyBFvC5J/++4UKyjenf2XCERGgqcDAYnCWoVXjOp5LCUCETlyIVEE/
@derektamsen
derektamsen / convert_text_case
Created March 10, 2015 19:22
These aliases help convert text from upper case to lower case with 'upper2lower' or lower case to upper case with 'lower2upper'. This will handle mixed case and ensure the output is all lower or all upper. It also ignores any non-alpha characters and includes them in the output.
#!/usr/bin/env sh
upper2lower () {
echo "${@}" | tr '[:upper:]' '[:lower:]'
}
lower2upper () {
echo "${@}" | tr '[:lower:]' '[:upper:]'
}
@derektamsen
derektamsen / check_ssl_cert_status
Created March 10, 2015 19:18
Outputs the openssl certificate details including the chain, subject, and expiration date. Usage: `./checksslcert <fqdn> [port]` - <fqdn>: The hostname or fully qualified domain name of the cert to check - [port]: The tcp port the ssl service is listening on. This will default to `443` if unspecified.
#!/usr/bin/env sh
checksslcert() {
echo "QUIT" | openssl s_client -servername ${1} -connect ${1}:${2:-443}
echo "QUIT" | openssl s_client -servername ${1} -connect ${1}:${2:-443} | openssl x509 -noout -dates
}
@derektamsen
derektamsen / troubleshoot_puppet_runs
Created November 14, 2014 23:51
Commands to Troubleshoot Puppet
#!/usr/bin/env bash
# test hiera parsing
sudo puppet apply -e "notice(hiera('<key_to_test>'))" --debug | grep hiera