Creating music setlists algorithmically

Last semester I was in an object oriented programming course using Java (which means I had to learn Java). The focus of this course was a group project, for which I managed to convince my teammates to build a setlist manager for live performing musicians. What does it do? First you input every song you know how to play by describing it in terms of key, length, tempo, and genre.  Then you describe your gig: total length of performance, number and length of breaks, and genres you wish to play. Lastly, you hit generate and enjoy your semi-randomized setlist created to your specifications. Notice I said semi-randomized. When building sets it is generally advisable to have your performance vary in key and tempo between songs.  The first song is completely random (to the extent that ArrayList.shuffle() is random). The 2nd, 4th etc. songs will always be a different key from the previous, and the 3rd, 5th etc. songs will never be within 10% of the tempo of the previous. So you might get 2 song

Reading PDF files from the terminal

My next adventure in reinventing the wheel is with PDF documents. So far I've found nothing that directly displays PDF files within the terminal (Fim indicates some work in this area, but I've yet to sort it out). The first and most obvious remedy is to simply convert it to text using pdftotext (in the poppler-utils package). This works well enough for many documents, but does not display any images and may not work well with scanned text. For a true representation, we're going to use pdftoppm (same package) to create JPEGs so we can view them in Fim. Let's get the full script out of the way first #! /bin/bash # invoke script with a pdf file as the arguement RBUF=10 #number of pages to innitially display while remainder of file is converted mkdir /tmp/pdfout NAME=$(basename "$1")  #Removes leading file structure NAME=$(echo ${NAME// /_} | cut -f 1 -d '.') #removes spaces and file extension PAGES=$(pdfinfo "$1" | grep Pages | cut -

Simple Internet search from the command line

In my quest to eliminate GUIs from my computing life, I decided to try and streamline my web browsing process. Typically I open Links to my favorite search engine, Duckduckgo, and proceed from there. However, it occurred to me that I might be able to invoke a search directly from the command prompt with the engine's URL parameters. With Duckduckgo, we accomplish this with the URL where term is the search term. For multiple word searches, we will have to replace the spaces between words with "%20". This of course is way to much typing, and user typing is a vector for error. Script time. My favorite new BASH script feature the ability to add parameters at invocation by including $1 etc. where appropriate. In this application, the parameters are my search terms #! /bin/sh  links$1%20$2%20$3%20$4%20$5%20$6 In order to get it to open in a new Tmux window (

The CLI Netbook: Entertainment Software

My entertainment options in a text only environment are obviously going to be a bit limited, but so bad as you might think. For viewing still images, I have fim, which somehow is able to draw on the screen without the X windows manager. It's not great, but it works well enough. With some tweeking, I was even able to get the Links browser to redirect image files to it for more seamless browsing. Fim doesn't work well over ssh so I'll be omitting screenshots. For music, there is Music On Console (MOC) which is a well thought out jukebox with an intuitive interface. It supports playlists, shuffle, EQ, and a whole a bunch of other features I haven't really bothered with. While functional as a stand alone music player, MOC is also well suited for a remotely controllable (via ssh) music player. I could definitely see myself installing it on a Raspberry Pi hooked up to the home stereo while accessing files from a file server on a local network. If nothing else it wo

The CLI Netbook: Productivity software

If we're going to have a useful command line only machine we are going to have to recognize a couple of fundamental truths. Firstly: Many of the common tasks we perform with computers today used to be done with computers prior to adoption of graphic interfaces. My old 286 ran MS Word just fine. Email, spreadsheets, relational databases; these all came into being in the 1970s. Second: The terminal ways of doing things are going to be different from the GUI methods. Information will not be in images but in text, we will have menus instead of buttons, and you might as well leave the mouse at home. First let's look at text editing. Ubuntu comes with Nano, a very basic editor which is suitable for writing short scripts but not much else. I'm mostly working with Vim as my editor (Vim itself is a topic that could fill volumes), but this is not well suited for letters, prose, or anything meant for human eyes. For this I installed WordGrinder, but honestly I haven't yet ha

The CLI Netbook: Interface

(Note: All screenshots were taken from my Windows 10 PC using the Ubuntu subsystem accessing my CLI netbook via ssh) The CLI experience of my youth was perfectly functional, but lacked a lot of the conveniences of graphical interfaces. In particular, the inability to simultaneously run multiple programs was a clear disadvantage for DOS. Fortunately, the modern Linux CLI user has Tmux available, and that completely destroys that distinction. Tmux, for the uninitiated is defined as a "terminal multiplexer". It allow the screen to be split into multiple sections called panes, or switch between unseen terminal instances which it calls windows (think multiple desktops if you are accustomed to GUI Linux distros). Screen is another program similar in function to tmux, but I have yet to test it. In a practical sense this means I can edit source code in the left pane, and compile and run on the right. I need only hit ctrl+b then left or right to select between them. For

The CLI Netbook: My experiment in a high utility, console only computer

The plan right now is to have this as a series of posts. Given my prior history this is unlikely, but what the hell.  My main computing machine was a retirement/back to school gift from family. It's a really nice MSI laptop with Nvidia graphics. Because I am likely to need specific software for school (like Visual Studio), and because my Linux installs have had a habit of frying video cards, I'm leaving Windows 10 on this one (but of course I have Ubuntu for Windows on it as well). I'm also not wanting to take this to school unless I actually have a specific need for it, and at this time I don't. My computer science classes are so far introductory, and nothing I have written employs a graphical interface. This new shiny machine is overkill for such tasks. Enter the netbook. Years ago netbooks were the new fancy tech for people who wanted a computer but didn't actually need a computer while traveling. In my days as an official blogger for the Army Re