Skip to content

Instantly share code, notes, and snippets.

View reasonableperson's full-sized avatar

Scott Young reasonableperson

View GitHub Profile
@reasonableperson
reasonableperson / pancakes.hs
Created April 16, 2016 04:33
Revenge of the Pancakes (Google Code Jam 2016, Qualification Round, Problem B)
import Data.List
-- Code Jam boilerplate
main :: IO ()
main = getContents >>= putStr . showCases . tail . lines
showCase :: (Int, String) -> String
showCase (i, c) = "Case #" ++ show i ++ ": " ++ show (solve c)
@reasonableperson
reasonableperson / patch-foo-beefweb.sh
Last active December 22, 2018 10:09
Patch for foo_beefweb-0.3.fb2k-component so it works in iOS Safari
# Paste this into your shell in the same directory as foo_beefweb-0.3.fb2k-component.
# This script will create foo_beefweb-0.3.patched.fb2k-component, which you can then
# install in the foobar2000 GUI.
# The patch allows you to change tracks by clicking as well as double- clicking. This
# isn't the best on a desktop, but since double-clicking is broken in iOS Safari,
# something like this is needed to be able to change tracks.
unzip foo_beefweb-0.3.fb2k-component beefweb.root/bundle.js;
printf "\ndocument.addEventListener('DOMContentLoaded', _ => {\
@reasonableperson
reasonableperson / sqlite3-git-smudge-filter.md
Last active March 26, 2021 01:20
sqlite3-git-smudge-filter

If you configure git like this:

git config filter.sqlite3.clean 'sqlite3 %f .dump'
git config filter.sqlite3.smudge 'sqlite3 %f'
echo '*.db filter=sqlite3' >> .git/info/attributes

and you have an sqlite3 database in a *.db file:

@reasonableperson
reasonableperson / convert-oracle-arch-arm.md
Last active June 5, 2022 10:01
Install Arch Linux with FDE on Oracle ARM VM

Replace boot volume with Alpine

Create a new Oracle Linux VM. You can disable in-transit encryption, as encryption will be implemented at the OS level with dm-crypt. Connect to the VM with SSH (you can't connect from the Cloud Shell as the opc user has no password). Then, run the following to reboot the VM into Alpine Linux:

sudo su
wget https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/aarch64/alpine-virt-3.15.0-aarch64.iso
dd if=alpine-virt-3.15.0-aarch64.iso of=/dev/sda; sync
reboot
@reasonableperson
reasonableperson / whisper-stream.sh
Last active October 1, 2024 19:49
generate running transcript for web streams
#!/bin/bash
# whisper-stream.sh
#
# Take a url supported by yt-dlp, dump 30-second segments to the current
# directory named by unix timestamp, and transcribe each segment using Whisper.
#
# example: TZ=Australia/Canberra ./whisper-stream.sh "https://..."
#
# The time displayed is the time when ffmpeg first opens the segment for