Current focus: EndSoftwarePatents.org: wiki, mailing list, news, donate

Photo of me at FOSS Means Business, 2006-03-16

Some commands I like

Menu


But first... My favourite software packages

These are software packages that make my life easier. I use the GNU/Linux operating system, but most or all of these are available for other operating systems too.

Adding Ogg vorbis comments

Here's a command to add a comment to an Ogg Vorbis audio file:

vorbiscomment -a Ciaran_O\'Riordan_-_End_Software_Patents_-_LibrePlanet_2009.ogg -t "comment=Transcript: http://groups.fsf.org/index.php/Ciaran_O'Riordan_(LP09)"

Making oggs directly from CD

Convert track 1 of a CD to ogg via pipe:

cdparanoia 1-1 - | oggenc -q 3 -o track-01.ogg - ; done

And to do that for a CD of 20 tracks:

for i in `seq -w 1 20`; do cdparanoia ${i}-${i} - | oggenc -q 3 -o track-${i}.ogg - ; done

OCR'ing a .pdf or .ps

gs -sPAPERSIZE=a4 -sDEVICE=pnmraw -r300 -dNOPAUSE -dBATCH -sOutputFile=- -q input.pdf | ocrad > output.text

There's an article about a more thorough method here: How To Extract All Text From PDFs (Including Text In Images).

Replacing spaces in filenames with underscores

Here's a command which operates on all .pdf files in the current directory. It replaces any spaces in the filenames with underscores.

find . -maxdepth 1 -iname '*.pdf' | while read n; do mv "$n" `echo "$n" | sed 's/ /_/g'`; done

Reading lists of words from files

I have two files with lists of words, each has one word per line, and I want to run a command based on all combinasions of those two lists. For a practical example, there's a website that posts videos each day, but they don't provide a convenient way to download them. The file names are different each day, but many use a recurring set of words used to form the file names, so if I try all those combinations, I'll get a few videos each day.

cat prefixes | while read p; do cat suffixes | while read s; do wget -c http://videos.gmanews.tv/2010a/03/${p}_030710_${s}.flv; done ; done

In this example, I'll also have to change the date (mmddyy).

Playing audio at increased speeds

To play a file at 1.5 times normal speed with mplayer:

mplayer -af scaletempo=scale=1.5 the_file.ogg

This increases the playback speed without increasing the pitch.

Run a program in another language

If you want to run, say, GIMP in Spanish, you can lauch it with this command from a shell command line:

LANGUAGE=es_ES gimp

A forgotten ffmpeg command

Hmm, I don't remember exactly what this does:

ffmpeg -i filename -ab 56 -ar 44100 -b 500 -s 320x240 filename.mpg

It might have something to do with Rockbox's instructions for shrinking videos.


(Go: homepage of Ciarán O'Riordan)

Valid XHTML 1.1! Powered by GNU Made with Emacs FSF

© Copyright 2010 Ciarán O'Riordan. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. Distribution of modified versions of all or part of this article are permitted, provided that such works carry three things: (1) this copyright notice, (2) prominent notices stating the that it has been changed, and (3) information for how to obtain the original (such as a URL).