Skip to content

Instantly share code, notes, and snippets.

@derektamsen
derektamsen / vscode-hujson-settings.json
Last active December 16, 2025 08:03
Example vscode syntax handler for tailscale hujson files (jwcc)
{
"files.associations": {
"*.hujson": "jsonc"
},
"json.schemas": [{
"fileMatch": ["*.hujson"],
"schema": {
"allowTrailingCommas": true
}
@derektamsen
derektamsen / Makefile-hujson
Last active December 16, 2025 08:03
Basic tailscale policy format makefile
.PHONY: all
all: fmt ## Default target
.PHONY: fmt
fmt: ## Format code
@echo "🧹 Formatting code..."
hujsonfmt -w policy.hujson
.PHONY: help
help: ## Show this help message
@derektamsen
derektamsen / create-win-selfsigned-cert.ps1
Last active May 15, 2025 19:03
Create a self-signed certificate on windows and add it to the local machine certificate store. The generated certificate can only be used for webservers and does not include extensions for client usage.
@Params = @{
KeyAlgorithm = 'ECDSA_nistP256'
KeyUsage = 'DigitalSignature'
DnsName = $(hostname)
CertStoreLocation = 'cert:\LocalMachine\My'
TextExtension = @('2.5.29.37={text}1.3.6.1.5.5.7.3.1')
}
New-SelfSignedCertificate @Params -confirm
@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/