Skip to content

Instantly share code, notes, and snippets.

Derek derektamsen

Block or report user

Report or block derektamsen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@derektamsen
derektamsen / update_rdshost_cert_thumbprint.ps1
Created Aug 22, 2019
Update Remote Desktop Host Certificate Thumbprint. Used when applying an externally issued machine certificate for use with RDP.
View update_rdshost_cert_thumbprint.ps1
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 Aug 22, 2019
Configures a Google Authenticator TOTP in slot 2 on a yubikey for use on linux.
View linux-onetime-setup.py
#!/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 / B11DDA4A.pub
Created Feb 27, 2018
gpg public key for Derek Tamsen <tamsen@squareup.com> id B11DDA4A
View B11DDA4A.pub
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFMH190BEADSmiCuq9KgZf4vQ/oFAUNFmw6rKyKprBRe55Go1cRI+KmZWC1T
Z122xm1CH+CNCBiHT/oniJyTwrMsCj3VUj2KR5CgyjrbaMmdk7XhT4BtX/GhRExN
1flgEirksExqdTfj94cLM6kvxFPDbKLkGvWBqkPgKpx55JkfK4FLEGd2Ppd/HtHE
SOeMBUhfBZbOexSKZoNlDcvWqyn/aoVZx+TxVRC3mRFqeViziPjGa3nL3HKmLZ8/
sBU/IJ9Edos8MT96O2vw7rOBQLiTuJOMGtC5py8hQTuobVwvDwD1ajlhwSyDYemr
EqRzrXthH5ZMLHNKcisctJk3SBcLDv3kLqlhmqOUxrVjdGoVBlAKKLEANFqspANS
l91s5okPKKnqdxRK7ySbaERREri9MHD/s/wLuxfBTAMLapUy+DYghYJChiWDCSxf
jaRM3TDwEwtcz/5u2r0hRETFH+SD3kz3m7jPQTbTSEFvuNgCPmSIFX/ZpceJL3w+
@derektamsen
derektamsen / hooks-pre-commit
Last active Sep 4, 2016
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
View hooks-pre-commit
#!/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 Jan 25, 2016
I am proving ownership of the github account for https://keybase.io
View keybase.md

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 Nov 9, 2015
gpg public key for Derek Tamsen <dtamsen@gmail.com> id 7ED71D98
View 7ED71D98.pub
-----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 Mar 10, 2015
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.
View convert_text_case
#!/usr/bin/env sh
upper2lower () {
echo "${@}" | tr '[:upper:]' '[:lower:]'
}
lower2upper () {
echo "${@}" | tr '[:lower:]' '[:upper:]'
}
@derektamsen
derektamsen / check_ssl_cert_status
Created Mar 10, 2015
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.
View check_ssl_cert_status
#!/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 Nov 14, 2014
Commands to Troubleshoot Puppet
View troubleshoot_puppet_runs
#!/usr/bin/env bash
# test hiera parsing
sudo puppet apply -e "notice(hiera('<key_to_test>'))" --debug | grep hiera
@derektamsen
derektamsen / puppet_master_crl_cache_update
Last active Aug 6, 2017
This script will connect to the rest api of the puppetca listed in your puppet config and update the local copy certificate revocation list. This is useful when you have distributed puppet masters fronted by a webserver and passenger.
View puppet_master_crl_cache_update
#!/usr/bin/env bash
# This script will connect to the rest api of the puppetca listed in your
# puppet config and update the local copy certificate revocation list.
#
# This is useful when you have distributed puppet masters fronted by
# a webserver and passenger.
#
# https://docs.puppetlabs.com/guides/rest_api.html#certificate-revocation-list
# https://ask.puppetlabs.com/question/3843/multiple-puppet-masters-with-single-ca-server/
You can’t perform that action at this time.