Less than a week after the release of Apple’s iphone in the US, an off-hand comment has finally made me excited about the future of mobile communication technology. OpenMoko is a Linux-based platform that is designed to enable you to “Free Your Phone”. In only a few months time, the first smartphone built for the OpenMoko software platform will be publicly available. Read the rest of this entry »
Posts Tagged GNU/Linux
Today I have used my recently acquired Lenovo USB 2.0 Super Multi-Burner Drive to burn a CD from Gentoo GNU/Linux. I used the following command,
cdrecord -v -v -tao fs=16m dev=/dev/sr0 -data FILENAME.iso
and tested it by adding a -dummy option before the -tao. The drive shows up as /dev/sr0 on my X60s system.
A lot of people suggest turning the Caps Lock key into a Control key. The more I’ve thought about it, the more it does actually make sense. The Caps Lock key enjoys prime real estate on the keyboard, typically right next to the home row, while its function is only rarely (if ever) required. For many applications (such as my favourite editor Vim) the Control key is a regularly used and vital element of, well, control. Read the rest of this entry »
I wanted to upload a sound track to my Sony Ericsson phone just so that I could use it in the video editor on the phone. It turned out that sounds must be in amr format, and that ffmpeg could convert from ogg.
ffmpeg -i 12-Danny\ Boy.ogg -ar 8000 -ab 12.8 -ac 1 dannyboy.amr
Mplayer can play 3gp movies created on my Sony Ericsson phone, but does not play the audio. The audio can be extracted using ffmpeg.
ffmpeg -i input.3gp -acodec mp2 -ar 22050 -f wav output.mp2
Once the audio is extracted, it can be recombined with the video using mencoder.
mencoder -audiofile audio.mp2 -o output.mpg -oac copy -ovc lavc -lavcopts vcodec=msmpeg4v2 movie.3gp
The resulting mgp file can be easily played in mplayer.
After downloading Elephant’s Dream, I found that my laptop was not quite capable of playing even the 1024 version. I discovered that mencoder can resize video.
mencoder elephants_dream_1024.avi -ovc lavc -lavcopts vcodec=mpeg4 -vop scale=768:432 -oac copy -o output.avi
It was necessary to manually work out the new dimensions (768×432) so that the aspect ratio remained fixed.
I wanted to send an article from a Free Software Magazine issue to a friend. Extracting pages from a PDF turned out to be easy with pdftk.
pdftk FILE.pdf cat RANGE output OUTPUT_FILE.pdf
RANGE can be something like 26-34, or a collection of such excerpts (1-25 35-end).
In order to demonstrate oscillations in the Earth’s magnetosphere, I wanted to turn a sequence of static images into an animation.
A given set of frame images can be combined to form an MPEG-4 movie using mencoder. In this case the source files were png images with resolution 320×240, and I wanted 24 frames per second.
mencoder mf://*.png -mf w=320:h=240:fps=24:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi
I often want to perform a bash command on a whole collection of files, and was delighted to discover that bash has a for-loop that makes this sort of thing easy. For example, to rename all the files in the current directory with the spaces converted to underscores, execute
for ii in *; do mv -i "$ii" "${ii// /_}"; done
This bash syntax can be used in many situations, such as feeding a whole set of files through PovRay for tracing.
The bash for-loop can be also used with a numerical counting variable.
for ((i=0; i=10; i+=1)); do cp SOME_FILE SOME_FILE$i; done
Using kernel.org Patches
Jun 6
Patches provide a way to keep the Linux kernel up to date without regular large downloads. The latest kernel patches are available at kernel.org, but I had to look around to find out exactly how to use them.
Download the latest patch (for instance patch-2.6.17.7.bz2) into /usr/src/linux and make sure that the previously applied patch (patch-2.6.17.6.bz2) is in this directory also. Remove the previous patch with
bzcat patch-2.6.17.6.bz2 | patch -p1 -R
The new patch can then be applied using
bzcat patch-2.6.17.7.bz2 | patch -p1
Things can be cleaned up by renaming the source directory to reflect the lastest patch level (and fixing the symbolic link) and removing the now obsolete patch file (in this case, patch-2.6.17.6.bz2).

