Skip to content

Instantly share code, notes, and snippets.

Avatar
🗃️
Archiving all the things!

Nick Sweeting pirate

🗃️
Archiving all the things!
View GitHub Profile
@pirate
pirate / get_tenant_schemas.py
Created Oct 11, 2020
Create a django settings DATABASES entry for each tenant schema in a PostgreSQL database
View get_tenant_schemas.py
def get_tenant_schemas():
if IS_TESTING or IS_MIGRATING:
return ["public", "test"]
DATABASE_UTIL_CONNECTION = psycopg2.connect(
host=POSTGRES_HOST,
port=POSTGRES_PORT,
sslmode=POSTGRES_SSL,
user=POSTGRES_USER,
@pirate
pirate / docker-compose.yml
Created Oct 11, 2020
Docker-compose Wordpress + Argo setup
View docker-compose.yml
version: '2.4'
services:
mariadb:
image: mariadb:10
volumes:
- ./data/mariadb:/var/lib/mysql
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
@pirate
pirate / docker-compose.yml
Last active Oct 14, 2020
Example sidecar ingress containers for argo, wireguard, tailscale, letsencrypt, caddy, and ssh sidecair containers
View docker-compose.yml
# Example docker-compose.yml for argo, wireguard, tailscale, letsencrypt, caddy, and ssh sidecair containers
version: '2.4'
services:
demo:
hostname: demo
image: nginx:alpine # Your image goes here
expose:
- 80
@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 Sep 6, 2020
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="
You can’t perform that action at this time.