More Diverse Music Thanks To Computers


I was just going through my to-do list about 10 minutes ago and one item on it was “listen to more diverse music”. Well, I’m lazy and that’s never going to happen on its own. So I wrote a short shell script to make it easier.

I goggled “list of music genres”, used cURL to download it, and html2text (RIP Aaron) to get the list into a usable form.

curl http://www.musicgenreslist.com/ | html2text > ~/music-genres

Then all I needed was the following short script which could be a one liner if I was fond of writing messier code.

#!/usr/bin/env bash

set -eo pipefail

genre_file="$HOME/music-genres"
DATE="$(gdate -d "0 days ago" +'%Y-%m-%d')"
address="my email address@email.com"
genre="$(shuf -n 1 "$genre_file")"

# Redirect from /dev/null to avoid prompt so we can send a message with empty body, noninteractively.
mutt -s "Music genre for $DATE: $genre" "$address" </dev/null

One more line to my crontab will send me a random genre every day at midnight.

00 *  *  * * . bash $HOME/bin/suggest-song 2> $HOME/song-err

And that’s another way that computers let you be lazy.

Related Posts

Derivative AT a Discontinuity

Just because 2 things are dual, doesn't mean they're just opposites

Boolean Algebra, Arithmetic POV

discontinuous linear functions

Continuous vs Bounded

Minimal Surfaces

November 2, 2023

NTK reparametrization

Kate from Vancouver, please email me

ChatGPT Session: Emotions, Etymology, Hyperfiniteness