Skip to content

Instantly share code, notes, and snippets.

View fawkesley's full-sized avatar

Paul Fawkesley fawkesley

View GitHub Profile
@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)
View scrubEmailsAndNamesOfGamesStartedOver90DaysAgo.js
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 / 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.
View poweroffat80percent.sh
#!/bin/sh -eu
while true
do
sudo whoami > /dev/null
BATT_PERCENT=$(cat /sys/class/power_supply/BAT0/capacity)
@fawkesley
fawkesley / logger.go
Created May 22, 2022 16:58
Golang logger with custom colour support
View logger.go
package logger
import (
"errors"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
View pos58.md
@fawkesley
fawkesley / change.md
Created February 7, 2020 15:51
change a booking date
View change.md

booking server:

select * from bookings where primary_email='<EMAIL>';

(write down the booking UUID, game UUID)

update bookings SET date='', game_url='', sent_joining_instructions=false WHERE uuid = '';
@fawkesley
fawkesley / utm_params_notes.md
Last active December 7, 2021 15:22
utm_medium / utm_source / utm_campaign
View utm_params_notes.md
  • 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)

@fawkesley
fawkesley / commands.sh
Last active December 16, 2019 20:17
SSH user / authorized keys
View commands.sh
export NEW_USER=exampleuser
export NEW_HOME=/home/$NEW_USER
sudo useradd $NEW_USER \
--home $NEW_HOME \
--create-home \
--shell /bin/bash \
--groups ssh
sudo passwd $NEW_USER
@fawkesley
fawkesley / .gitconfig
Created March 11, 2019 21:33
.gitconfig snippet for nice `git log` showing signature status
View .gitconfig
[log]
date = relative
[format]
# https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-log.html#_pretty_formats
pretty = "%C(yellow)%h %C(blue)%<(50,trunc)%s %C(green)%<(8,trunc)%ad %C(reset)%ae%n%>(69,trunc)%C(magenta)%G? %GS%n%-b"
@fawkesley
fawkesley / raid-1-luks.md
Created January 11, 2019 10:51
Raid-1 + LUKS encrypted filesystem
View raid-1-luks.md

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
View termtosvg-emoji.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.