Skip to content

Instantly share code, notes, and snippets.

View cpu's full-sized avatar
❄️

Daniel McCarney cpu

❄️
View GitHub Profile
@cpu
cpu / LICENSE
Last active May 19, 2022 10:32
LPC BK-Tree data structure and True Damerau-Levenshtein Distance implementation for command suggestions/spellchecking.
The MIT License (MIT)
Copyright (c) 2022 Daniel McCarney
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@cpu
cpu / ldmud-hook.py
Created April 23, 2022 16:08
Certbot deploy hook for LDMud.
#!/usr/bin/env python3
#
# Certbot LDMud Deploy Hook
# Paradox@Dune - 2021-03-07
#
# Adapted from:
# https://github.com/greenhost/certbot-haproxy/blob/develop/certbot-deploy-hook-example
#
# After installing Certbot, install the deploy hook (as root):
# curl -o /etc/letsencrypt/renewal-hooks/deploy/ldmud-hook \
@cpu
cpu / heap.c
Last active October 9, 2021 01:54
LPC heap data-structure implementation for LDMud 3.3.x+
/*
* LPC Heap w/ Structs
* Paradox@DUNE
*
* A general heap data-structure[0] implemented in LPC using a struct type.
* Closely modelled on the Go programming language's heap implementation[1].
*
* Example Integer Min-heap Usage:
* inherit __PATH__(0)"heap";
* struct Heap min_heap = new_heap(({ 10, 5 }), (: $1 < $2 :));
@cpu
cpu / public_suffix_list.dat.diff
Created August 2, 2019 13:29
example metadata"
diff --git a/public_suffix_list.dat b/public_suffix_list.dat
index b446a29..eb45e62 100644
--- a/public_suffix_list.dat
+++ b/public_suffix_list.dat
@@ -7058,7 +7058,7 @@ org.zw
// newGTLDs
-// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2019-06-14T10:00:50-04:00
+// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2019-08-02T09:28:48-04:00
@cpu
cpu / sctTestCerts.go
Last active August 1, 2019 15:14
A small program written to generate test x509 subscriber certificates with mock embedded Certificate Transparency SCTs.
// sctTestCerts is a small program written to generate test subscriber
// certificates for the zlint `sct_policy_count_unsatisified.go` unit tests. It
// depends on `github.com/google/certificate-transparency-go` for providing
// needed SCT types.
//
// Usage:
// 1) go get github.com/google/certificate-transparency-go
// 2) go run sctTestCerts.go -differentLogs=[true/false] -lifetime [int] -scts [int]
//
// -differentLogs
@cpu
cpu / idna-encode.go
Created November 2, 2018 14:25
Tiny command line tool to encode IDN domains from stdin to ASCII using IDNA2008. Errors are printed to stderr. ASCII results are printed to stdout.
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
"golang.org/x/net/idna"
@cpu
cpu / embedjws.go
Created August 25, 2017 14:22
A small Go program using go-jose.v2 to generate an example JWS in the ACME V1 style.
package main
import (
"crypto/rand"
"crypto/rsa"
"fmt"
"os"
"gopkg.in/square/go-jose.v2"
)
@cpu
cpu / keyidjws.go
Created August 25, 2017 14:18
A small Go program using go-jose.v2 to generate an example JWS in the ACME V2 style.
package main
import (
"crypto/rand"
"crypto/rsa"
"fmt"
"os"
"gopkg.in/square/go-jose.v2"
)
@cpu
cpu / libreswan_download_tls_test.sh
Created April 22, 2017 17:09
Inconsistent hostname mismatch error for download.libreswan.org
$> alias libreswanTLSTest='openssl s_client -connect download.libreswan.org:443 -CApath /etc/ssl/certs -verify_hostname download.libreswan.org 2>/dev/null </dev/null | grep "Verify"'
$> alias libreswanTLSTestSNI='openssl s_client -connect download.libreswan.org:443 -servername download.libreswan.org -CApath /etc/ssl/certs -verify_hostname download.libreswan.org 2>/dev/null </dev/null | grep "Verify"'
$> for i in $(seq 10); do libreswanTLSTest; done
Verify return code: 0 (ok)
Verify return code: 62 (Hostname mismatch)
Verify return code: 0 (ok)
Verify return code: 62 (Hostname mismatch)
Verify return code: 0 (ok)
Verify return code: 62 (Hostname mismatch)
Verify return code: 0 (ok)
@cpu
cpu / keybase.md
Created June 20, 2015 23:12
Keybase.io Github Proof

Keybase proof

I hereby claim:

  • I am ccppuu on github.
  • I am cpu (https://keybase.io/cpu) on keybase.
  • I have a public key whose fingerprint is EA93 53F3 1EAA C378 B854 99AE 9599 2CFB 3537 3091

To claim this, I am signing this object: