Category Archives: Software

Howdoi – Instant Coding Answers via Command Line

The idea is simple – ask a question and get an answer.

$ howdoi format date bash
> DATE=`date +%Y-%m-%d`

Howdoi solves life’s little coding mysteries like the always frustrating command line flags for tar (as illustrated by XKCD).

Github repo
Blog post describing the tool.

Scientific Python…the easy way

tl;drUse Anaconda

The scientific programming libraries available for Python are among the best available out there. Libraries such as scipy, scikit-learn and scikit-image the among the easiest to use that I have come across. Of course much of that is due to the fact that Python is an amazing language…but we won’t get into that in this post.

Using the any of these libraries is dead easy once you get the hang of Python. The documentation is also (usually) pretty good. However, installing the libraries and their dependencies can be a pain in the ass. Most of these libraries are updated pretty frequently so you really want to use the latest version at anytime. So while the Debian repository has most of the packages you would need (not sure about other distros), the versions on the repository is usually outdated (with good reason).

One option (for Debian users at least) is neurodebian but I have had some problems with neurodebian in the past. My initial solution was to install as many as of the dependencies as possible from the Debian repositories and using pip for the latest versions of the different libraries. This works fine in most cases. Problem is, when you want to upgrade to newer versions keeping track of how you installed each library, deciding what to upgrade, etc. becomes a pain (which is why we have apt-get…but we’ve already established that we can’t do that).

The next best solution that I have come across is Anaconda from Continuum Analytics. Anaconda installs everything you need for scientific programming in Python (including Python itself) within a directory anywhere on your machine. Works on Mac, Windows and Linux (any distro as far as I know) and is really simple to install. It even comes with Spyder, a MATLAB-like IDE for Scientific Python programming (although I prefer Vim+terminal).

Installing Anaconda

For Mac and Windows, just download the GUI installer and follow the instructions…hard to mess up. For Linux systems, just download the shell script from and run it to install anywhere on machine. If you’re installing it within your home directory (or anywhere else you have permissions) you won’t need root access. However, if you are planning on allowing multiple users to have access to Anaconda, I suggest the following approach.

  1. Install Anaconda in /etc/anaconda (you will probably need root access to do this)
    sudo bash
    When asked if you want to install Anaconda in /root/anaconda enter /etc/anaconda instead
  2. Create a user group called anaconda
    sudo addgroup anaconda
  3. Next change the ownership of the /etc/anaconda directory
    sudo chown -hR root:anaconda /etc/anaconda
  4. Add the root user to the group anaconda
    sudo adduser root anaconda
  5. Now add any user needs access to Anaconda to the group anaconda. Make sure you use adduser instead of usermod to do this (usermod doesn’t work sometimes)
    sudo adduser username anaconda
  6. (optional) Check that the users were actually added to the group anaconda
    sudo groups username
  7. Finally for each of those users, add the following line to the end of their .bashrc file (usually found in /home/username/.bashrc) using a text editor of your choice
    export PATH="/etc/anaconda/bin:$PATH"
  8. Restart the machine (just in case)

That’s it! Just to see if everything is working fine, run Python. You should see something like the following in the first line.

Python 2.7.5 |Anaconda 1.6.1 (64-bit)| (default, Jun 28 2013, 22:10:09)

The important bit to lookout for is ...|Anaconda.... If you see that everything should be fine.


  • I used /etc/anaconda but you can use anything you want really
  • I did this on a Debian 6.0 (squeeze) box. Should be the same for most other systems but just be careful
  • If you ever need to uninstall Anaconda just delete the directory /etc/anacondapiece of pie 🙂
  • If you need any help, first place to look is of course the Anaconda documentation. Otherwise, the Anaconda mailing list would be your best bet.
Tagged , ,

Kindle 3: Blank Page in PDF (fix)

Just a quick tip for anyone having issues viewing PDFs on a Kindle 3. I noticed that some pages just went missing (were shown as blank on the Kindle) even though I could view them fine on my Mac. If you are having this issue, one way to fix it is using Mac’s Preview application. I found that just making a change – such as inserting an extra page then removing it again – and re-saving the PDF fixed the issue. No problems with PDFs on the Kindle now.

No idea why it works, it just does. May have something to do with this but I don’t have Adobe Acrobat on my Mac and the process seemed quite tedious (although it may not be, I have no idea) so I didn’t try it. Worth a try if you are on Windows I guess.

Tagged , , , , , , , , , , , , , , , , , ,

pyTwit 0.2.2

pyTwit version 0.2.2 is out now. I don’t have a Windows executable in this one. The biggest change in this version is coloured text. It really makes quite a big difference. A complete list of changes for this release from the previous release is available here or in the ‘CHANGELOG’ file in the archive which you can download here.

Tagged , , ,

pyTwit 0.2.1

I just uploaded a new version of pyTwit. It fixes a bug in the previous version. The ‘timeline’ command was throwing up an index error so this fixes it. Many thanks to Jeff Dimond for reporting it in the first place.

Tagged , , , , ,


I’ve decided to call my Twitter app pyTwit. I’ve searched the Twitter Fan Wiki list of apps and there doesn’t seem to be a pyTwit yet so I’ve decided to claim the name (hey it rhymes!)

Anyways, I did a version 0.1.1 which was basically adding the functionality for posting tweets but I’ve also added many more features (like displaying multiple timelines and a command system for using the different features) and redesigned the code structure so I’ve decided to call this one version 0.2

You can check it out here. I’ve also included a compiled Windows executable in the archive for those who are unfortunate enough to be running using Microsuck Windows…me included 🙁

Tagged , , ,

My own Twitter app

OK I know we really don’t need yet another Twitter app but I’m doing this to practice programming in python. This is version 0.1 so I’ll definately add more stuff as I go along.

I’m using the XML feed from the Twitter REST API. I know there are modules to process the XML feed (like minidom and sax) but I decided to write my own method for processing the feed for educational purposes. My method won’t work with any feed (yet) but it’ll work fine for the Twitter feed.

At the moment, the app will only get your friends timeline and display it for you. I’ll add more functionality later this week if I have the time. In the mean time please try it out. All comments/criticism/suggestions/feedback are welcomed.

Tagged , , ,