Binary Static

Interleaving two PDF files…

Posted in Applications, Hacking, Linux by Chris on October 17, 2010

Lightbulb…with no scripting required.  You’ll need the pdftk package though.  Say you’ve got a PDF file that has a two-sided layout and you want to trim the pages.  You could do this with pdfnup — however, your file may cut off from the even pages what it adds to the odd ones.  What now?  The solution is simple:

1. Use pdftk to split the file in even and odd pages seperately:

pdftk in.pdf cat 1-endeven output out.even.pdf
pdftk in.pdf cat 1-endodd output out.odd.pdf

2. Now would be the time to apply some pdfnup trimming magic to the two new files.

3. Use pdftk to burst these two files into single pages:

pdftk out.odd.pdf burst output %04d_A.pdf
pdftk out.even.pdf burst output %04d_B.pdf

4. Use pdftk to merge the pages back into one file, e.g.:

pdftk *.pdf cat output out.pdf

The important point here lies in step 3 when appending A or B to the odd and even page file names, because this allows glob sorting the pages like 0001_A.pdf 0001_B.pdf 0002_A.pdf 0002_B.pdf and so on.  I can’t believe I started to write a script before I realized how to solve this the simple way…

Tagged with: , , ,

Make the TrackPoint play nice with Fedora 13

Posted in Linux, SysAdmin by Chris on May 28, 2010

Moving faster
Speed and sensitivity defaults leave my Thinkpad’s trackpoint excruciatingly slow. So first thing is to create /etc/udev/rules.d/10-trackpoint.rules containing one line:

SUBSYSTEM=="serio", DRIVERS=="psmouse", ATTR{speed}="220", ATTR{sensitivity}="190"

I also like to scroll with the help of the middle button. For this Fedora 13 now uses user config files for X like /etc/X11/xorg.conf.d/20-thinkpad.conf reading e.g.:

Section "InputClass"
    Identifier      "Trackpoint Wheel Emulation"
    MatchProduct    "TPPS/2 IBM TrackPoint|DualPoint Stick|Synaptics Inc. Composite TouchPad / TrackPoint"
    MatchDevicePath "/dev/input/event*"
    Option	    "EmulateWheel"       "true"
    Option	    "EmulateWheelButton" "2"
    Option	    "Emulate3Buttons"    "false"
    Option	    "XAxisMapping"       "6 7"
    Option	    "YAxisMapping"       "4 5"

Tagged with: , , , ,

Smooth Transition to Goddard

Posted in Linux, SysAdmin by Chris on May 27, 2010

Fedora LogoYesterday, I upgraded my main system to Fedora 13.  Coming from the excellent Fedora 12, this was a smooth transisition indeed.  Everything’s working fine, the whole operation took less than two hours (4 min to install the new system from a pen drive, ca. 90 min to reinstall my package collection, including 2 GB downloads).  I was expecially impressed with the new auto-installing language packages, which gave me a localized desktop from the first login.   As exepected, on my Thinkpad X200 everything worked right out of the box.  No horrible Macification surprises either.  Thank you very much, Fedora team!  Keep up the great work!

Comfortably ripping CDs in the Linux console

Posted in Linux by Chris on December 2, 2009

Since I’m still converting my CD-Collection to listen to them on my iPod, I spent some time figuring out the easiest way to do this — in the background, with reasonable audio quality, and of course on Linux. My workflow now comes down to this:

  1. using the abcde script to rip the cd, some customizations apply
  2. using MusicBrainz through picard for tuning folder hierarchy and tags
  3. using Amazon’s API to download the cover files

This might be a bit more work than other approaches, but I get kick-ass audio files, clean tags and file names. This is my ~/.abcde.conf:

OUTPUTTYPE=mp3:" -V2 --vbr-new -q0 --lowpass 19.7 -b96"
mungefilename ()
echo "$@" | sed s,:,\ -,g | tr -d \'\"\?\[:cntrl:\]

Your device is probably named differently. The OUTPUTTYPE parameter sets the settings for lame. I chose a variable bitrate and basically cut off everything the ear can’t hear. The OUTPUTFORMAT parameter names and sorts the files into a iTunes-style hierarchy. I tweaked the mungefile() method to get Windows-style filenames, i.e. I want whitespace in my filenames.

I run abcde from a sandbox folder on my hard drive. It’s easy to put it in the background by starting it with screen. Having collected new music, I filter the whole stuff through picard to get top-notch MP3 tags. What picard can’t find I’ll add to the MusicBrainz database myself from the original CD.

As I use boxee to play and display my audio files on my media box, I want neat high-resolution cover images in each folder. I wrote a short python script to retrieve the covers from Amazon via their store API. Currently, I’m trying to add a GUI, which allows to scan whole music collections and provide missing or wrong images in batch mode. Once I’m done, I’m going to roll this into a Ubuntu package and distribute it.

Tagged with: , ,