Skip to content

Instantly share code, notes, and snippets.

View StevenMaude's full-sized avatar
🏠
Working from home

Steven Maude StevenMaude

🏠
Working from home
View GitHub Profile
@StevenMaude
StevenMaude / iplayer-url-to-pid.sh
Created March 26, 2016 22:56
Get episode PIDs from a file containing BBC iPlayer URLs, one per line
#!/bin/sh
# Usage: ./url-to-pid.sh <URL file>
cat $1 | grep -oP '(?<=episode/)\w+' | paste -d"," -s
@StevenMaude
StevenMaude / signature_count.sh
Last active June 25, 2016 21:40
Count up UK Government petition signatures, across countries and constituencies.
#!/bin/sh -e
if [ -z "$1" ]; then
echo "Usage: signature_count.sh <UK_GOVERNMENT_PETITION_JSON_URL>"
echo "e.g. signature_count.sh https://petition.parliament.uk/petitions/131215.json"
fi
DATA=$(wget -qO - "$1")
echo "Signatures by country:"
echo "$DATA" | jq .data.attributes.signatures_by_country[].signature_count | awk '{ sc += $1 } END { print sc }'
echo "Signatures by constituency:"
@StevenMaude
StevenMaude / mailin8.sh
Last active August 7, 2020 13:21
DEPRECATED: see https://github.com/StevenMaude/go-mailin8 — Retrieve most recent email from a mailinator.com temporary email box using curl and jq at the command line; useful if you just want some account activation link, but too lazy to visit the site directly. (It's actually mailinfewerthan8usefullines, rather than mailin8usefullines, but, hey…
#!/bin/bash -e
# mailin8.sh: Collect From, Subject, Body from most recent mail
# in a mailinator.com account.
# Usage: mailin8.sh <local_mailbox_name>
# <local_mailbox_name> is the bit before @mailinator.com
# Create temporary file for cookiejar
TEMP=$(mktemp)
@StevenMaude
StevenMaude / das_notes.md
Last active April 17, 2018 20:33
Destroy All Software screencast notes

Destroy All Software screencast notes

Earlier this year, the Destroy All Software screencasts were free to download. I grabbed a few that sounded interesting to watch.

These are notes of new things I learned.

0004: Source Code History Integrity

@StevenMaude
StevenMaude / bluetooth_audio_shift.sh
Last active August 21, 2020 10:05
Adjust audio-video sync of videos slightly to compensate for audio delay problems in Ubuntu with Bluetooth audio
#!/bin/sh -eu
# Not sure if this is a headset issue or Ubuntu issue.
# Maybe your itsoffset differs: the value here works for me
# Usage: ./bluetooth_audio_shift.sh <video_filename>
ffmpeg -i "$1" -itsoffset 0.350 -i "$1" -vcodec copy -acodec copy -map 0:1 -map 1:0 -strict -2 "$1.audio-shift.mp4"

Notes from reading Practical Go

Notes of the key points copied/summarised from Dave Cheney's Practical Go for more concise reading/reference.

It's worth reading the original document as there is more exposition there of the ideas presented.

These are terse notes only; I'm not providing my own commentary, opinion

@StevenMaude
StevenMaude / how-to-speak.md
Created December 28, 2020 18:40
Notes on "How To Speak" by Prof. Patrick Winston

How To Speak by Prof. Patrick Winston

MIT 2018 talk

How to start

  • Suggests not starting with a joke.
    • Audience isn't necessarily attuned to your mode of speaking.
  • Start with an empowerment promise; what will the audience get from the talk.
@StevenMaude
StevenMaude / Ubuntu-python-source-build.md
Created April 25, 2021 21:04
Compiling Python from source on Ubuntu

Basic guide

Pooled together from maybe several place(s) on the web that I can't remember:

sudo apt install libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev tk-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev
./configure --prefix="$SOME_DIRECTORY" --enable-optimizations --with-ensurepip=install

Some additional notes

@StevenMaude
StevenMaude / 10-mx-revolution.hwdb
Last active June 8, 2022 21:08
Remapping Logitech MX Revolution second mouse wheel under Wayland
# Function:
# This HWDB entry maps the second mouse wheel to volume controls.
#
# Usage:
# 1. cp 10-mx-revolution.hwdb /etc/udev/hwdb.d/10-mx-revolution.hwdb
# 2. sudo systemd-hwdb update
# 3. sudo udevadm trigger
#
# References:
# https://wiki.archlinux.org/title/Map_scancodes_to_keycodes