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://dl.dropboxusercontent.com/u/10891647/smake_1.0-1_all.deb
(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):
https://dl.dropboxusercontent.com/u/10891647/smake


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

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. That should have been:

      Zach,

      Nice idea for smake. Since you already have smake packaged, you could put it in a PPA without too much extra work. Then people could install it from the command line like:

      sudo apt-add-repository ppa:user/ppa-name
      sudo apt-get update
      sudo apt-get install smake

      This link has more information on creating PPA's if you're interested. The main benefits of using PPA's are that installation of packages is easy and updates are easily passed on to users of the PPA.

      -Jason

      Delete
  2. Haha this is awesome :D

    I agree with Jason, adding this to PPA and/or GitHub would be cool.

    P.S. Wouldn't it be easier [and safer] to create an alias rather than creating a symlink at /usr/bin?

    ReplyDelete