My Scripts and Programs
Musik Open Source Music Creator
Musik is an open-source text-to-music converter. It takes text such as
C4 D4 E4 F4 G4 A4 B4 C^4
and translates it into audible music. It supports the following:
- Basic Notes (C, D, E, etc.)
- Octaves (^ & _)
- Sharps and Flats (# & b)
- Chords - Predefined:
- Major 7th
- Minor 7th
- Augmented 7th
- Chords - user-made
- Instrument changes - both in melody and in chords
- Multiple melody notes at the same time
- Scale changes
- Tempo changes
- Sections - to avoid retyping the same thing over and over again
- Emulate holding down the sustain pedal
- Tie notes together
- Simple beat specification using MIDI channel 10
- Custom instrument mappings (to access sounds in expanded sound banks)
- Custom beat symbol mappings (to access sounds other than the ones mapped by default)
- Per-file option to specify the file to save the music to
- Allows you to split your music into multiple musik files and import them
You can download the current version (version 3.0 released 11/08/2016) here:
Note: Due to the fact that I am too poor to afford a Mac and my Hackintosh virtual machine broke, I will no longer be compiling for macOS. However, it should be relatively painless to compile from source on macOS with the instructions in the repository.
Musik is released under the GPL version 3.0 (or later). Go to GitLab.
bkmk is a bookmark manager heavily inspired by pass. You can find more information at the GitLab repository.
ScriptsSince I have started using Linux, I have developed a couple of scripts to make my life easier.
This shell script + Haskell program can be used to find a specific SSID (useful if you use iw to figure out the authentication parameters for a certain SSID, since the associated parameter in iw appears to be broken).
Save the shell script as whatever you want (and mark it executable), and save the Haskell program as parse_wifi.hs somewhere in your path (and mark it executable). Calling this is pretty simple — simply type the name of the script followed by the SSIDs you wish to filter for or type --list to list all of the available SSIDs. Side note: Yes, they say we shouldn't screenscrape iw. No, I don't care. I will keep this script up to date if the format of the output changes 😉
This shell script can be used to create a shortcut to any website using a .desktop file. It takes two inputs - the website and the name of the menu item - and creates a .desktop file which launches Firefox with the specified website. This means it automatically appears in the menu in the Gnome, KDE, and XFCE desktop environments. The appify script can be found here.
Ah - the wonders of mailing lists. I started a club at school and needed to email all of the members at once, preferably without any interaction from me. At first, I resorted to emailing each member individually, but I knew that could not stand for long. Out of necessity, I was forced to come up with a script which would save the day. I use a command-line email client called
mutt, which is capable of accepting an address, a subject, and a body. It will then automatically email the person with the subject and body I specify. I then came up with a script which passes each address in the addresses argument to mutt with the subject and body arguments also specified, optionally with an attachment also specified.
All of the arguments, with the exception of the attachment, are plain text documents. The addresses file is set up with one address per line. The subject and body files are just plain text files. This script was inspired by the Windows-only program febootimail and serves my purposes well.
This simple script simply adds smart playlist functionality to MPD/MPC (my music player of choice).
It reads in the file (the only argument to the script), parses it (I will explain the syntax in a minute), and replaces the current MPD playlist with the playlist generated by the script (I believe that is how most smart playlists work - if you only want to ever add songs, comment out the line
mpc clear; and SmartPlaylist won't clear the current playlist). Now what does a typical SmartPlaylist file look like?
The first value is the category you are searching and the second value is the value you are searching for within that category. You can use any search category that is a valid search category for MPC (the MPD client this script uses).
Any good computer user knows that they should back up their documents and other files. I knew I should be backing up my stuff, but I hadn't found any good, simple, backup programs for Linux. Hence, I created my own shell script that does the job for me.
This script will efficiently backup your data (provided you configure it correctly). The only things you should have to change are BACKUP_ROOT (change to point to the directory you want to back up to - everything will end up inside this directory), SOURCE_ROOT (change to point to the directory that everything you want to back up is in - usually, the home folder will do), files (change to the list of files and folders you want to back up), vfiles (change to the list of files and folders you want to back up with versions), and possibly rsync_args (the arguments you would like to pass to rsync - the defaults I have provided should be sufficient). It also optionally makes a backup of your system partition using LVM snapshots and backups of your LUKS headers. In addition, this script saves a couple of key files like the list of sources and the list of installed software. However, this is particular to Debian and Debian-based distributions, so you may need to modify it for your distribution.
The sCard format is a simple and logical way to store your contacts. A sample entry would look something like this:
First Name : Last Name : Phone1 \n Phone2 \n Phone3 : Email1 \n Email2
However, the columns aren't predefined. That is, another sample entry could look something like this:
Last Name : First Name : Email1 \n Email2 : Phone1 \n Phone2
This renders the format much more flexible than other formats for two reasons:
- You can define your own columns and the program doesn't care.
- You can have as many email addresses or phone numbers or whatever for each contact and the program doesn't care.
However, there are a couple of problems with the format. It is not accepted by any major email clients or phones, and it doesn't look that pretty. Enter the sCard Converter. This simple Python script converts from the sCard format to LaTeX (to make it look pretty) and vCard (to allow you to import your contacts into phones and email clients). The one catch is that if one is exporting to vCard, one must specify the headers at the top of the file. The header must use vCard compatible header names (full list here) followed by square brackets denoting how many columns the header should combine. For example, if the entry is:
First Name : Last Name : Phone1 \n Phone2 \n Phone3 : Email1 \n Email2
then the corresponding header would be:
FN : TEL : EMAIL
As mentioned earlier, the header row must be the first row in the sCard file. You might as well always write a header row because the LaTeX export ignores it anyway. The LaTeX export will output a LaTeX table which you can then
\include into a full LaTeX file to get a pretty address book! The vCard export will output a vCard file that should be compatible with most (newer) phones and almost all webmail/email clients. The script also lets you choose which column to sort by. The sCard converter script can be found here.
This simple Python script uses extended attributes (supported by all common filesystems (although OS X programs apparently delete them)) to store tags for files and folders. The script allows adding tags, deleting all tags for a given file, removing specific tags for a given file, listing currently used tags, and searching for files with a specific tag. It requires the xattr module. That module apparently only supports Linux, Mac OS X, FreeBSD, and Solaris at present, although I have successfully tagged files on an NTFS file system.
I have developed other scripts, but they are not as useful as these and are mostly fixes for certain issues I was having at the time.