linux

PDF to PostScript conversion: pdf2ps versus pdftops

5 February, 2010 - 12:16

Occasionally, I have to convert a PDF file to Postscript (e.g. for subsequent processing with some PostScript utility). In the Linux/command line area, I know two options: pdf2ps and pdftops. I also know that one of the two sucks has some issues and the other is better. But because their names are so close I can't manage to remember which one to take. This post should put an end to that!

[Spoiler alert and a questionable mnemonic: pdftops is da top.]

Read more...

An audio conversion use case: comparison of execution speed between SoX, FFmpeg and MPlayer

4 December, 2009 - 15:44

In a previous post I listed some options for audio data manipulation (conversion of format, sample rate, bitrate, trimming, etc), with SoX, MPlayer and FFmpeg. The obvious question is now: which one is best?

Read more...

Audio format conversion cheat sheet (slash how to)

2 December, 2009 - 14:17

In my day job, I regularly have to convert/transcode/re-encode audio data from one format to another. Because I typically have to do this in batch jobs, I'm mostly dealing with command line tools (on Linux) like Lame, SoX (Sound eXchange), MPlayer and FFmpeg. Having a cheat sheet of how to invoke them with the desired options has proven to be very useful, so here is mine. Note that I only cover the operations I mostly need, like format conversion, sample rate conversion, conversion to mono and trimming/cropping. If you need more/other functionality, look in the man pages or ask your favorite search engine.

[Update] also see a follow up blog post about an execution time comparison between SoX, FFmpeg and MPlayer.

Read more...

My bashrc, bash aliases, profile and other files

19 October, 2009 - 15:30
Categories:

I spend a lot of time on the (bash) command line in (Linux and OS x) and it's always good for productivity to have your favorite set of shortcuts, aliases, perferences, predefined (environment) variables and such at your fingertips. You know, all the stuff that lives in .bashrc, .profile, .vimrc, .git, etc.

I have access to several systems (at home, at work, remote servers, etc) and from time to time I'm sitting behind a system that doesn't know my preferences yet. I considered using some sort of version control system to "synchronize" these preference files between my setups, but (apart from the practical hurdles) it generally seemed overkill, especially since each setup can have its own peculiarities and customizations.

So, mainly for my own reference, I'm keeping an list of the most important general stuff here. Be welcome to cherry-pick (or suggest additions).

Read more...

Time-lapse of construction site "Het Ufo" of Ghent University

1 October, 2009 - 13:04
Categories:

In front of the place I work, Ghent University is constructing a new building with two large auditoria and office space, called "Het Ufo" (Universiteitsforum). Being in the digital age, there was of course a webcam pointing at the construction site. Since 21 September 2007, I had a cron job running to capture a photo each day. Apparently, the cron job died on 18 august 2009 for some reason, so my pile of daily photo's stopped growing. Time to put them together in a time-lapse video:

Update: Michiel Ronsse (see comments below) also had a cron job running and kindly provided me with extra frames from July 2007 to September 2007. This is the part when there is no concrete yet.

Read more...

How to find out which version of Ubuntu you are running?

11 September, 2009 - 09:51
Categories:

How to find out which version of Ubuntu you are running?

Use one of the commands below:

lsb_release -a
cat /etc/lsb-release
cat /etc/issue

kthxbye

Jython and PYTHONPATH

9 September, 2009 - 11:07
Categories:

For some small tools or jobs I use Jython so I can (re)use some existing Java code, while still writing in Python. I also have various custom Python modules, of which I put the paths in my PYTHONPATH environment variable, so those modules are easily available in Python scripts and interactive sessions.

However, Jython does not automatically pick up the PYTHONPATH information, for reasons that seem to be discussed in this Jython development mailing list thread.

Jython 2.5 introduced the JYTHONPATH environmental variable as Jython-equivalent of PYTHONPATH, so setting both to the same value should do the trick for most use cases (unless you're working in a setup with incompatible Python an Jython versions).

For Jython versions prior to 2.5 (like 2.2.1 in my case), there is an easy "workaround", by invoking Jython with the appropriate -Dpython.path=foo/path:bar/path option. For example as follows:

Read more...

Showing the running command in a bash script with "set -x"

29 May, 2009 - 09:03

Bash scripts are handy for putting a bunch of longer running jobs in one batch. In some occasions it can be useful to know which command is running at the moment, especially when the commands do not generate output themselves or this output is redirected to files.

Bash has a simple setting to achieve this:

set -x

which, according to help set, enables the following feature:

-x Print commands and their arguments as they are executed.

Disabling it just takes a mere

set +x

You can play with it from the bash command line itself, or put it in a bash script of course.

Read more...

Setting global XFig defaults for working with LyX/LaTeX

15 May, 2009 - 10:26

When making a document with Lyx (or LaTeX), I often create figures and diagrams in XFig. I know, Xfig's user interface sucks big time. (I tried the Java port JFig, but that one even feels worse to me.) However, the main reason I bite the bullet is that it enables a work flow where the text you add to the XFig figure is typeset by LaTeX when you compile the document. This way, the text in the figure is in the same font as the normal text in the document and, maybe more importantly, you can use all the fancy LaTeX commands, e.g. to put mathematical expressions, symbols and formulas in your figure.

To make this work, one of the required things is to enable the "special" flag on the text objects in XFig, and use a LaTeX font. These things are disabled by default and manually setting for every text object is a bit tedious. To changes these defaults, you can start xfig from the command like with the following options:

Read more...

How to be a better grepper

28 April, 2009 - 17:37
Categories:

If you're not afraid of a a bit o' Unix/Linux/OSX command line delight, you're probably having grep hanging on your tool belt.

One option you'll wonder how you could live without is --color, which enables highlighting of the word or pattern you are grepping for. I find it so useful that I've put the following alias in my .bashrc:

alias grep='grep --color=auto'
Read more...