Skip to content

Instantly share code, notes, and snippets.

View pdmccormick's full-sized avatar

Peter David McCormick pdmccormick

View GitHub Profile
@pdmccormick
pdmccormick / server-name-wordlist-mnemonic.py
Created December 19, 2022 20:38
Randomly choose memorable server names from a wordlist
#!/usr/bin/env python3
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
words = '''
acrobat
africa
alaska
albert
@pdmccormick
pdmccormick / example_curve25519.go
Created December 29, 2021 20:44
Using golang.org/x/crypto/curve25519
package main
import (
"bytes"
"crypto/rand"
"encoding/hex"
"log"
"golang.org/x/crypto/curve25519"
)
@pdmccormick
pdmccormick / days
Created May 3, 2018 16:11
days: a simple utility for calculating the period of time between dates
#!/usr/bin/env python3
import sys
from datetime import datetime, timedelta
try:
from dateutil.parser import parse as dateutil_parser
except ImportError:
print('ERROR: Module `python-dateutil` not installed, please install or run:', file=sys.stderr)
print('', file=sys.stderr)
@pdmccormick
pdmccormick / hg2git-20170804.json
Created August 4, 2017 20:07
CPython Mercurial to Git commit mapping
This file has been truncated, but you can view the full file.
{
"hg2git": {
"09a84091ae962394be0ed5fac62f77defae97cbc": "299978dfe387ad543706754fa5601297408240c2",
"48033017c78f2018cad2254bbff4328c667ac4ae": "9445ce57f1cdb93dc40ba267a322c4f2631b5edd",
"fd808ee68eb9855ee19b134a60b54e617026814b": "d603f645d99102627c7776ebeb2c3d52eb1d3b4a",
"aeb1f941663f698450c903cb917568e84ddedb01": "4a358de34e5963b68bef1a398f0e0686331912e7",
"f69d91a7cf714894edd046ee57e314206ca3a785": "c3c805e8b2aa6e728e38fbbae6cdb43ae6cbb9dd",
"72ad2f1e9919afec1cc7beab8d89841aaf55ab16": "4b0538c47239865d2e0542812fe365ec13a56e29",
"50164abbfc982125da93ca3f6a354ec2cc6b1347": "cb31d1fe1b55013b8cb60338fd75a5c8511d2cc1",
"3c0203499ae535c5e557dcf1c140446059821c94": "85ee3e1b1ed9b7480966f00f0629153127b19ca6",
@pdmccormick
pdmccormick / keybase.md
Created December 23, 2016 06:10
Keybase

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@pdmccormick
pdmccormick / ssh-setup-for-great-good.md
Last active December 19, 2015 01:49
A short guide to setting up named hosts with password-free access in your SSH config file

SSH Setup For Great Good

Step 1: Create a public/private keypair for your machine

Only if you haven't already done so before:

ssh-keygen -t rsa -C "$USER@$HOST" -f ~/.ssh/id_rsa