Skip to content

Instantly share code, notes, and snippets.

View pirate's full-sized avatar
🗃️
Archiving all the things!

Nick Sweeting pirate

🗃️
Archiving all the things!
View GitHub Profile
@pirate
pirate / docker-compose.yml
Last active January 14, 2022 19:34
Example networking sidecar ingress containers for Cloudflare Argo, Wireguard, Tailscale, LetSencrypt, Caddy, and SOCKS/SSH tunnel containers in Docker Compose.
# Example networking sidecar ingress containers for Cloudflare Argo, Wireguard, Tailscale, LetSencrypt, Caddy, and SOCKS/SSH tunnel containers in Docker Compose.
# https://gist.github.com/pirate/1996d3ed6c5872b1b7afded250772f7c
# Goes well with these docker-compose database container examples:
# https://gist.github.com/pirate/1fafaa18a47254f388aa5c0f79f7d263
version: '2.4'
services:
demo:
@pirate
pirate / check_password.html
Last active March 27, 2020 11:40
An example of password locking an html page by checking a hash password and setting a secret cookie.
<center>
Enter the password to view the secret page.
<br><br><br>
<input id="pass" type="password" >
<br><br>
<button id="submit">Submit</button>
<br>
@pirate
pirate / hand_coded_redux.html
Created February 26, 2020 22:31
A demo of redux coded by hand with React
<html>
<div id="root"></div>
<script>
const initial_state = {
playbar: {
playing: true,
position: 40.6345,
currentTrack: 2342355,
currentPlaylist: 124234,
@pirate
pirate / plink-plonk.js
Created February 16, 2020 07:23 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@pirate
pirate / dramatiq_dashboard_server.py
Created November 8, 2019 10:45
Standalone HTTP webserver serving the Dramatiq-Dashboard WSGI using bjoern and a redis broker to read dramatiq task state.
#!/usr/bin/env python3
# Dramatiq dashboard server script.
# pip install dramatiq[redis] dramatiq-dashboard bjoern
import bjoern
import argparse
import dramatiq
from dramatiq.brokers.redis import RedisBroker
from dramatiq_dashboard import DashboardApp

2019 Toronto Open Networks Ligtning Talks

Nick Sweeting @theSquashSH (Twitter) @pirate (Github) Monadical.com


Internet Archiving (3min)

  • 1 min: Intro to internet archiving
    • Why is preserving information important? why does humanity create libraries and museums?
    • How has it been done so far?
@pirate
pirate / argo.sh
Created August 12, 2019 14:53
Cloudflare Argo Tunnel helper script that waits for the server to come up before starting the tunnel.
#!/usr/bin/env bash
# usage:
# ./bin/argo cloud.monadical.com http://127.0.0.1:9089
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
DOMAIN="$1" # e.g. "cloud.monadical.com"
URL="$2" # e.g. "https://127.0.0.1:9089"
read SCHEME HOST PORT <<<$(IFS="://"; echo "$URL")
@pirate
pirate / ssl.sh
Last active May 20, 2021 00:21
SSL certificate generation script supporting openssl, mkcert, and letsencrypt with manual/standalone/webroot/cloudflare-dns/digitalocean-dns.
#!/usr/bin/env bash
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
SCRIPTNAME="$0"
HELP_TEXT="
@pirate
pirate / dns.sh
Last active December 28, 2023 15:00
Dynamic DNS updater script for DigitalOcean and CloudFlare (using bash, curl, and jq)
#!/usr/bin/env bash
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
SCRIPTNAME="$0"
HELP_TEXT="
@pirate
pirate / safe_number.py
Last active July 18, 2023 22:08
A SafeNumber type for Python that implements the fractions.Fraction interface with guards to prevent implicit operand type casting leading to a loss of precision.
# This implements a SafeNumber class which wraps Decimal and Fraction to warn
# when infix math or comparison operators may cause dangerous implicit type conversion.
#
# Implicit type conversion when using operators is sneaky with Decimal/Fraction:
# >>> Fraction(10) == 10.0000000000000001
# True
#
# But with SafeNumber, this throws an error to protect against this scenario:
# >>> SafeNumber(10) == 10.0000000000000001
# Traceback (most recent call last):