Skip to content

Instantly share code, notes, and snippets.

View fawkesley's full-sized avatar

Paul Fawkesley fawkesley

View GitHub Profile
@fawkesley
fawkesley / firefox.md
Last active February 23, 2024 12:37
Firefox profile addons and settings
@fawkesley
fawkesley / raid-1-luks.md
Created January 11, 2019 10:51
Raid-1 + LUKS encrypted filesystem

make encrypted luks partition on raid-1 array from free space

  • use cfdisk /dev/sda to create a new partition in free space with type "Linux RAID"
  • repeat for /dev/sdb
  • cat /proc/mdstat to see what /dev/mdX device is next
$ mdadm --create --verbose /dev/md4 --level=1 --raid-devices=2 /dev/sda6 /dev/sdb6
@fawkesley
fawkesley / scrubEmailsAndNamesOfGamesStartedOver90DaysAgo.js
Created November 15, 2023 16:30
Google Sheets Apps Script to redact certain columns for rows older than 90 days (for use with Google Forms)
function scrubEmailsAndNamesOfGamesStartedOver90DaysAgo() {
const sheetName = 'responses';
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheetByName(sheetName);
if(!sheet) {
throw new Error('failed to get sheet `' + sheetName + '`');
}
const data = sheet.getDataRange().getValues();
@fawkesley
fawkesley / randomize-mac-addresses.sh
Last active July 25, 2022 06:24
In Ubuntu 16.04, randomize WiFi MAC addresses with a daily rotation - /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
#!/bin/sh
# /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# INSTALL
#
# > curl -L 'https://gist.github.com/paulfurley/46e0547ce5c5ea7eabeaef50dbacef3f/raw/56ee5dd5f40dec93b8f7438cbdeda5475ea3b5d2/randomize-mac-addresses.sh' |sudo tee /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# > sudo chmod +x /etc/NetworkManager/dispatcher.d/pre-up.d/randomize-mac-addresses.sh
# Configure every saved WiFi connection in NetworkManager with a spoofed MAC
@fawkesley
fawkesley / poweroffat80percent.sh
Last active May 23, 2022 01:27
poweroffat80percent.sh - wait for laptop battery to drain to 80% then power off. save battery lifetime.
#!/bin/sh -eu
while true
do
sudo whoami > /dev/null
BATT_PERCENT=$(cat /sys/class/power_supply/BAT0/capacity)
@fawkesley
fawkesley / 30-randomize-mac-address.conf
Last active May 22, 2022 21:42
MAC address randomization in Ubuntu 17+ (>= 1.4.1): save to /etc/NetworkManager/conf.d/
# /etc/NetworkManager/conf.d/30-randomize-mac-address.conf
# REQUIRES NETWORK MANAGER >= 1.4.1 (Ubuntu Zesty and above)
# Thanks to https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/
# This randomize your MAC address for *new* connections
# Be sure to change your existing (saved) connections in
# /etc/NetworkManager/system-connections/*
@fawkesley
fawkesley / logger.go
Created May 22, 2022 16:58
Golang logger with custom colour support
package logger
import (
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
@fawkesley
fawkesley / yealink_t20.md
Last active March 16, 2022 15:59
Yealink T20 VoIP phone setup notes
@fawkesley
fawkesley / utm_params_notes.md
Last active December 7, 2021 15:22
utm_medium / utm_source / utm_campaign
  • utm_medium required - can be e.g. referral, social, email
  • utm_source is required - e.g. facebook.com
  • utm_campaign is optional e.g. june-giveaway

Use these utm_* parameters in these scenarios:

facebook ad (boosted post / ad)