Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Steven Maude StevenMaude

🏠
Working from home
View GitHub Profile
View practical-go.md

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 / bluetooth_audio_shift.sh
Last active Aug 21, 2020
Adjust audio-video sync of videos slightly to compensate for audio delay problems in Ubuntu with Bluetooth audio
View bluetooth_audio_shift.sh
#!/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"
@StevenMaude
StevenMaude / das_notes.md
Last active Apr 17, 2018
Destroy All Software screencast notes
View das_notes.md

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 / mailin8.sh
Last active Aug 7, 2020
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…
View mailin8.sh
#!/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 / signature_count.sh
Last active Jun 25, 2016
Count up UK Government petition signatures, across countries and constituencies.
View signature_count.sh
#!/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 / iplayer-url-to-pid.sh
Created Mar 26, 2016
Get episode PIDs from a file containing BBC iPlayer URLs, one per line
View iplayer-url-to-pid.sh
#!/bin/sh
# Usage: ./url-to-pid.sh <URL file>
cat $1 | grep -oP '(?<=episode/)\w+' | paste -d"," -s
@StevenMaude
StevenMaude / extract_gpx_data.py
Last active Mar 15, 2016
Quick hacky script to extract date and 2D length data from GPX files to CSV using gpxpy; at least compatible with Py2.7/3.4
View extract_gpx_data.py
#!/usr/bin/env python
""" Extract date and 2D length data from GPX files in current directory. """
from __future__ import division, print_function
import decimal
import glob
import gpxpy
def main():
@StevenMaude
StevenMaude / convert_gpx.sh
Last active Sep 13, 2020
Use gpsbabel to convert Garmin .FIT to .gpx — requires a fairly recent version of gpsbabel (minimum 1.4.3); see https://www.stevenmaude.co.uk/posts/using-garmin-forerunner-watches-with-linux for more details on using Garmin watches with Linux
View convert_gpx.sh
#!/bin/sh
# Usage: convert_gpx.sh <FIT filename>
# Should works whether you include the .FIT extension or not.
filename=$(basename "$1" .FIT)
gpsbabel -i garmin_fit -f "$filename".FIT -o gpx -F "$filename".gpx
@StevenMaude
StevenMaude / sha256frompubkey.py
Last active Dec 3, 2020
Generate SHA256 fingerprint from a public key
View sha256frompubkey.py
#!/usr/bin/python
# coding=utf-8
# sha256frompubkey.py: Displays SHA256 fingerprint of public key in Python 2/3.
# Modified by Steven Maude from
# https://github.com/joyent/python-manta/blob/4de7445277c0971c7ff43ef246018d055ef21d20/manta/auth.py
# MIT licence.
# Usage: obtain a public key using ssh-keyscan <host> > key.pub
@StevenMaude
StevenMaude / get_coffee_break_french_podcasts.sh
Last active May 8, 2016
Download the Coffee Break French podcasts using curl
View get_coffee_break_french_podcasts.sh
#!/bin/bash
for i in {01..02} {04..24} {26..80} {301..340} ; do
curl -f -O -J -L https://media.libsyn.com/media/coffeebreakfrench/cbf-$i-basic.mp3
done
for i in {401..424} {426..440} ; do
curl -f -O -J -L https//media.libsyn.com/media/coffeebreakfrench/cbf-$i-main.mp3
done
# Handle cases which don't fit the normal pattern.
You can’t perform that action at this time.