Notes on Ubuntu (Linux) computing

Brief notes on installation, setup and other tasks in the Ubuntu world

Posts Tagged ‘ubuntu 12.04

Install CherryPy on Ubuntu 12.04

leave a comment »

CherryPy “is a pythonic, object-oriented web framework”. My goal is to use the package to make a simple desktop, browser-based application for looking at the output of statistical inference routines I’ve developed elsewhere — we’ll see if this works (I’m not sure yet).

In any case, the first step is to install with pip:

sudo pip install CherryPy

This should install without issue. There are tutorial scripts located at /usr/local/lib/python2.7/dist-packages/cherrypy/tutorial/ that you should be able to run. For example, the `hello world’ example can be started typing the following at you terminal:

python /usr/local/lib/python2.7/dist-packages/cherrypy/tutorial/

This will start up the web service and the resulting output can be seen in your browser by going to http://localhost:8080. To exit, close the web browser and use a Cntrl-C at the terminal to stop the server.

As I said above, I’d like to be able to read the contents of local files and display them in a browser. If a local file is called numbers.dat and contains the following:


We can use the following script to display the contents of the above file:

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8

"""A super simple example of reading a file and displaying results with

import cherrypy

class ReadFile(object):
    def index(self):
        page = "<html><body>\n"
        page += "<p>Read file: <i>numbers.dat</i></p>\n"

        with open("numbers.dat", "r") as f:
            for line in f.readlines():
                    col1, col2 = line.strip().split(',')
                    page += "<p>{:s} -- {:s}</p>\n".format(col1, col2)

        page += "</body></html>"

        return page = True

# start CherryPy

For more detailed documentation and tutorials, see the CherryPy website.

Written by Chris S

January 23, 2014 at 9:49 pm

Garmin forerunner and Ubuntu 12.04 — updated

leave a comment »

This post is an update to a previous post on getting information from my Garmin forerunner 305 using tools in Ubuntu 12.04. A comment on the previous post pointed out that svn repository I used was no longer working. This is not my repository, so I can’t do anything about that. However, I can make a github repository (the code seems to allow for free distribution) with the code I obtained in 2012. In the interest of being thorough I will provide complete instructions here, with updates as needed.

1 To download running information from my Garmin forerunner 305, I will use garmin-forerunner-tools:

sudo apt-get install garmin-forerunner-tools

2 To check the xml schema, we need xmllint. To make this utility available install libxml2-utils:

sudo apt-get install libxml2-utils

3 To do the file conversion between *.gmn and *.tcx we need utilities developed by others. I have made a github repository for them and you can obtain them using:

git clone

If you don’t have git installed, use:

sudo apt-get install git

4 Finally, we have to make use of the utilities we have installed. One way to do this is to make a directory to save data, for example:

mkdir ~/GarminData
cd ~/GarminData

To extract data, connect the watch via USB and run:


At this point you should see that there are *.gmn files in the GarminData directory that use the directory structure: Year/Month/filename.gmn .

Finally, we need to create *.tcx file that can be uploaded to Garmin Connect. To do this, we need to go to the directory where we placed the git repository (you should be able to execute ls in the directory and see the script gmn2tcx). The basic format of a command is:

./gmn2tcx ~/GarminData/Year/Month/filename.gmn > runfilname.tcx

A couple of important things to note, using the command as above, are:

  • the full path name must be provided for the input file
  • the output file runfilename.tcx will be placed in the same directory as gmn2tcx

Written by Chris S

October 21, 2013 at 6:17 pm

Install sympy from github

leave a comment »

Some quick notes on installing sympy package from github. Following instructions located here we first, clone the repo:

git clone git://

Then change directory and install

cd sympy
sudo python install

Finally test out the install by importing the package



import sympy

If everything is okay, as is was for me, there should be no complaints.

Written by Chris S

August 6, 2013 at 8:56 pm

Posted in Python, Ubuntu 12.04

Tagged with , ,

Install pip

with 2 comments

Install pip (a python package manager) on Ubuntu 12.04 using the command

sudo apt-get install python-pip

Test with

pip --help

Install packagename with the command

sudo pip install packagename

Written by Chris S

April 12, 2013 at 8:47 pm

Posted in computing, Python, Ubuntu 12.04

Tagged with ,

Install Tagbar vim plugin

leave a comment »

The vim plugin Tagbar provides a listing of classes, functions, etc when coding in vim.

Tagbar requires Vim 7.0 and Exuberant ctags 5.5. We install the later in Ubuntu 12.04 with the command

sudo apt-get install exuberant-ctags

Next, install tagbar with pathogen

cd ~/.vim/bundle
git clone git://

Toggle the code browser between visible and hidden using


Testing with *.py and *.tex files indicate the basics are working.

Written by Chris S

April 12, 2013 at 8:21 pm

Install NERD tree vim plugin

with one comment

In the previous post I installed the vim package manager pathogen. Now we take advantage of this tool to install nerdtree for browsing local directories inside vim.

Install with

cd ~/.vim/bundle
git clone

Nest, start a vim session and type

:help NERD_tree.txt

To toggle the directory listing between visible and hidden states use


Written by Chris S

April 12, 2013 at 5:34 pm

pdftk on Ubunt 12.04

leave a comment »

pdftk is a wonderful (command line) tool for manipulating pdf documents in all kinds of ways. See the list of examples at this page to get an idea of what can be done.

To install the version in the repository type

sudo apt-get install pdftk

As an example, I often like to combine many pdf plots into a single document to make viewing easier. This can be done with the command

pdftk *.pdf cat output combinedplots.pdf

This takes all pdfs in the directory and creates a single file called combinedplots.pdf — the source pdfs are not changed, only the new, merged document is created.

Written by Chris S

January 1, 2013 at 7:24 pm