Skip to content

Instantly share code, notes, and snippets.

@maxrothman
maxrothman / README.md
Last active October 6, 2019 02:01
Book diffing

Book diffing

This code was written when a new edition of a book series I like came out and I wanted to find out what was different between the old and new versions. The goal was to create readable diffs of English prose so that I could scan through the books and easily see what was different.

Most of the diffing tools out there are built with the assumption that their target texts are source code, or some other machine-optimized format, not prose, so I had to build some of my own tools.

The format that I found most readable had the following features:

@maxrothman
maxrothman / README.md
Last active June 20, 2021 18:45
Music searching

Music searching

This gist contains some tools I wrote to solve a problem I ran into when archiving folk tunes. Once I had 30+ tunes in the archive, it became hard to tell whether any particular tune I came across was already in the archive or not, and I'm usually not able to remember a tune note-for-note. The solution to this problem was to build a tool that could search for music scores based on an approximately-similar snippet.

Details

These tools are tuned to my particular setup, but the core should be generalizable. Here are the assumptions the code makes:

  • Scores are stored as compressed MusicXML (.mxl) files
  • The scores and both scripts are stored in the same directory
@maxrothman
maxrothman / wait-for-status.sh
Created March 27, 2017 18:09
Wait for a PR to pass tests
#!/usr/bin/env bash
USAGE="Usage: wait-on-status OWNER REPO PR#"
[ -z $1 ] || [ -z $2 ] || [ -z $3 ] && echo $USAGE && exit 2
state="pending"
inloop=false
while [[ "$state" = "pending" ]]; do
$inloop && sleep 60
sha=$(curl -s https://api.github.com/repos/$1/$2/pulls/$3/commits | jq -r '.[-1].sha')
state=$(curl -s https://api.github.com/repos/$1/$2/commits/$sha/status | jq -r '.state')
@tk0miya
tk0miya / index.txt
Created November 8, 2012 02:32
sphinxcontrib_section_autoref
===================
Example of autoref
===================
Section 1
==========
You can write reference to section title without any definitions:
:ref:`Section 1`