Skip to content

Instantly share code, notes, and snippets.

View theprojectsomething's full-sized avatar

theprojectsomething

View GitHub Profile
@theprojectsomething
theprojectsomething / Cloudflare Wrangler Pretty Console.js
Last active October 21, 2022 13:42
Cloudflare Wrangler Pretty Console
/***
* Cloudflare Wrangler Pretty Console 🌈
* ===
*
* Console.log with rainbow-like ease, with allowances for circular references,
* maps, sets and proxies ... none of which log very well otherwise.
*
* - use console.log and console.error, knowing it will be prettier (than nothing)
* - adds a nice little timestamp and reference to the calling function
* - designed specifically for @cloudflare/wrangler but will probably work with node too
@theprojectsomething
theprojectsomething / Passphrase-Encryption-for-the-Web.md
Last active September 6, 2022 06:24
Simple Passphrase-based Encryption Example for the Web

Simple Passphrase-based Encryption Example for the Web

A straightforward form of encryption using a passphrase (or a shared secret) that can be useful in web-based environments - especially in storage and transport. Consider e.g. securing sensitive user data in localStorage, or sending data via a third-party server (such as a serverless endpoint).

This method uses a passphrase to encrypt and decrypt any string, number, array, or other JSON-compatible object using AES in GCM mode and is ideal for cases where one party is both encrypting and decrypting. For cases where you are sending encrypted data to other parties you might consider alternative methods, such as public-key cryptography. For a comprehensive rundown of encryption me

@theprojectsomething
theprojectsomething / An Ubuntu WiFi Secure Captive Portal.md
Last active October 15, 2024 15:53
Guide: An Ubuntu WiFi Secure Captive Portal: Network Manager / DNSMasq / HA Proxy / Let's Encrypt

An Ubuntu WiFi Secure Captive Portal

Improvements, suggestions & fixes are welcome!

Captive portals can be a pain. Here's an opinionated and no-doubt entirely imperfect guide to setting one up for a WiFi access point on Ubuntu (tested on 20+), utilising Network Manager, DNSMasq, HA Proxy and (optionally) Let's Encrypt for a secure, locally hosted landing page.

_Note: This setup was originally designed for an offline WLAN, providing access to a small number of locally hosted domains ... think the WiFi media portal on a flight or boat. If you are looking to provide internet access behind a captive portal then this guide won't get you all the way there. That said, many routers have this capability built in, as do any number of open source router firmware solutions. So you probably don't need to roll your own. If you'd like to try anyway, Ha Proxy Stick Tables would probably come in handy. Very happy to update the guide with any p

@theprojectsomething
theprojectsomething / Firefox Pretty Tree Style Tab.md
Last active October 31, 2024 11:51
Tree Style Tab: Sliding sidebar / pinned + active tabs

Firefox pretty sliding sidebar / pinned / active tab theme for Tree Style Tab

Features

  • Auto-sliding draw for TST
  • Leaves 'pinned' and 'active' tabs visible in standard browser chrome
  • Leaves 'last-active' tabs visible for 3 minutes after becoming inactive
  • Where an active tab is pinned, leaves 'last-active' tab (x1) visible for 1hr

tree-style-tabs-theme

@theprojectsomething
theprojectsomething / a-short-history-of-reef-tracks-dot-org.md
Last active May 6, 2020 08:51
My site is up against NASA for a science webby

ReefTracks.org is up for a Webby

A short history of ReefTracks.org

Back in 2018 I was chatting to some shark researcher mates about their GPS tracking efforts, and how they were using video to manually animate their tagged sharks’ movements across the Great Barrier Reef. I love maps, and I thought I could speed up their workflow with a web-based animation they could screen record. I think they were dubious at the time, but I spent a few hours knee-deep in mapbox and codepen and sent through a rough demo anyway [1].

We didn’t really discuss it again until January 2019 when one of their whale sharks (GBR1), who I’d included in the demo, started pinging in frequently while tracking north towards Papua New Guinea. It was a real thrill to watch and became one of the longest recorded tracks for a whale shark.

I run the tech side of things at a very “4 people” small conser

@theprojectsomething
theprojectsomething / index.js
Last active November 7, 2019 09:34
Firebase Cloud Functions: Multi-file setup
const functions = require('firebase-functions');
const path = require('path');
const glob = require('glob');
const ENDPOINT_FOLDER = './endpoints';
const DO_NOT_DEPLOY = /^(admin|a|debug|d)$/;
const IGNORE = /^(ignore|i)$/;
const BREAK_ON_ERROR = true;
const is = {
@theprojectsomething
theprojectsomething / haproxy-multisite.md
Last active May 7, 2020 15:28
Guide: Multi-site / single-server with Linux Containers + HAProxy

Multi-site / single-server with Linux Containers + HAProxy

The below was completed on a Vultr 1xCPU / 1GB VC2 running Ubuntu 18.04, based on tutorials from Digital Ocean and SSDNodes, alongside various other helpful resources. Instructions do not work on Ubuntu 18.10.

Using this system I currently pay US$5.00 per month to host 2x wordpress sites (1x ecommerce) and 1x static nginx.

If you like the guide, consider signing up to Vultr with my affiliate code. Thanks!

Improvements to the guide (or better explanations) are most appreciated!

@theprojectsomething
theprojectsomething / node-npm-install.md
Last active August 2, 2017 08:57
Installing Node + NPM (the right way)

Installing Node + NPM (the right way)

Follow the steps below to get Node and NPM running cleanly on your machine.

1. Uninstall Node + NPM

npm uninstall npm -g
rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
rm -rf /usr/local/include/node /Users/$USER/.npm
rm /usr/local/bin/node
@theprojectsomething
theprojectsomething / launchpack.md
Last active May 21, 2017 08:35
launchpack - an npm-powered boilerplate launcher 👊

LaunchPack

An npm-powered boilerplate launcher 👊
  1. Download this gist
  2. drop the package.json where you develop .. say ~/www
  3. online with npm installed? open a terminal and boom ...
npm run launchpack
@theprojectsomething
theprojectsomething / serverless-redirect-aws.md
Last active May 20, 2017 12:02
Create a Serverless SSL Redirect with AWS

AWS Serverless SSL Redirect

Creating a serverless redirect requires four AWS services:

  • S3
  • Certificate Manager
  • Cloudfront
  • Route 53

Before You Start

Use the template below to create index.html. Include the URL you are redirecting to in place of {{ URL }}