Skip to content

Instantly share code, notes, and snippets.

🗃️
Archiving all the things!

Nick Sweeting pirate

🗃️
Archiving all the things!
View GitHub Profile
@pirate
pirate / check_password.html
Last active Mar 27, 2020
An example of password locking an html page by checking a hash password and setting a secret cookie.
View check_password.html
<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 Feb 26, 2020
A demo of redux coded by hand with React
View hand_coded_redux.html
<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 Feb 16, 2020 — forked from tomhicks/plink-plonk.js
Listen to your web pages
View plink-plonk.js
@pirate
pirate / dramatiq_dashboard_server.py
Created Nov 8, 2019
Standalone HTTP webserver serving the Dramatiq-Dashboard WSGI using bjoern and a redis broker to read dramatiq task state.
View dramatiq_dashboard_server.py
#!/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
View 2019 Toronto Open Networks Ligtning Talks.md

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 Aug 12, 2019
Cloudflare Argo Tunnel helper script that waits for the server to come up before starting the tunnel.
View argo.sh
#!/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 Aug 14, 2019
SSL certificate generation script supporting openssl, mkcert, and letsencrypt with manual/standalone/webroot/cloudflare-dns/digitalocean-dns.
View ssl.sh
#!/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 Jan 14, 2020
Dynamic DNS updater script for DigitalOcean and CloudFlare (using bash, curl, and jq)
View dns.sh
#!/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 Dec 11, 2019
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.
View safe_number.py
# For more info on math safety and data integrity in Python see here:
# https://github.com/pirate/django-concurrency-talk/blob/master/README.md#-the-correct-approach-with-a-custom-safenumber-type
from typing import Union, Any
from decimal import Decimal
from fractions import Fraction
SAFE_NUM_TYPES = (int, str, Fraction, Decimal)
SAFE_NUM_TYPES_STR = 'Union[int, str, Fraction, Decimal, SafeNumber]'
@pirate
pirate / alfred-clipboard.sh
Last active Apr 5, 2020
Script to manage searching, backing up, and collecting infinite clipboard history from the Alfred Clipboard History on macOS.
View alfred-clipboard.sh
#!/usr/bin/env bash
# This is a script that provides infinite history to get around Alfred's 3-month limit.
# It works by regularly backing up and appending the items in the alfred db to a
# sqlite database in the user's home folder. It also provides search functionality.
# https://www.alfredforum.com/topic/10969-keep-clipboard-history-forever/?tab=comments#comment-68859
# https://www.reddit.com/r/Alfred/comments/cde29x/script_to_manage_searching_backing_up_and/
# Example Usage:
# alfred-clipboard.sh backup
You can’t perform that action at this time.