Sunday, May 19, 2013

smake (sound make)

 [This script will play a sound notification when a make build is completed]

Compiling code and uploading it to an arduino used to cost me a lot of time. That wasn't because it took all that much time for the computer to complete the task, but rather because it was just enough time to get distracted by something else and forget about what was going on. So, I decided to code up a little script called smake that plays a good or a bad sound based on whether make succeeds or fails. To use it, simply replace make like this:

$ smake all

If successful, it will use mplayer to play a random sound from ~/.smake/good, and if the build fails, it will play a sound from ~/.smake/bad. This turned out to be useful and amusing, so I added another command to the script, sdo, that will play a sound upon completion of any arbitrary command, for example

$ sdo ls

To use the sdo command, simply create a symbolic link to smake named sdo somewhere on your path e.g.

$ ln -s ~/scripts/smake /usr/bin/sdo

Here's a deb package including some example sounds that will automatically install both smake and sdo:
https://www.dropbox.com/s/65wm4nbuumo5jii/smake_1.0-1_all.deb?dl=1
(if your system complains that the package is of "low quality", it's just because I entered my email wrong - you can check the details)

or here's the raw script (you have to provide your own sounds):
smake


The above link should just open in your browser so you can view the source code or copy and paste