Posts Tagged ‘Linux’

Packages I use, or don’t

I’ve been reinstalling Ubuntu (11.04, Natty Narwhal) a lot lately, because my computing environment is in a lot of flux right now. I wiped my desktop computer, have a relatively new laptop, had a laptop at Intel, and now have a desktop at CMU.

As a result, my package installation routine is more or less down to a science right now. Here are the packages I am sure to install–and sure to uninstall–right at the start, along with brief commentary.

apt-get install

  • zsh — my shell of choice.
  • vim exuberant-ctags — necessary for editing all manner of text file.
  • haskell-platform — Haskell, with batteries included.
  • texlive-latex-extra (and hence, most of the other LaTeX packages) — I use LaTeX whenever I need to format text.
  • subversion git — these come in handy, even if you don’t use one (or both) of these yourself.
  • gdebi gparted rar gv — I always find myself using these at random times. (The rar package also enables RAR support in many other programs.)
  • compizconfig-settings-manager — to tweak the default Ubuntu settings for window animation, etc.
  • gnome-do — like Quicksilver or Spotlight.
  • nautilus-open-terminal — adds “Open in Terminal” to your context menu.
  • vlc — plays all media files.
  • gimp — mostly to convert and resize images. (Alternative: imagemagick.)
  • cmus — my favorite library-based music player.
  • exfalso eyed3 — edit mp3 tags, before importing into library. I use exfalso for the text fields, and eyed3 to add album art.
  • deluge — a good BitTorrent client.
  • virtualbox-ose — for virtualization.
  • libncurses5-dev — needed for Petite Chez Scheme, below.

Other things to install

  • Google Chrome, from official .deb, so it adds the Chrome repository.
  • Petite Chez Scheme, for Scheme.

apt-get remove

  • unity ^unity-* — I don’t like the new Unity UI.
  • shotwell tomboy ubuntuone-client — I don’t want these programs.
  • empathy empathy-common — I prefer Pidgin, if I end up using IM.
  • gwibber gwibber-service-* — really?
  • transmission-common — I prefer Deluge.

If you want exactly the above, you can just run:

sudo apt-get install zsh vim exuberant-ctags haskell-platform texlive-latex-extra subversion git gdebi gparted rar gv compizconfig-settings-manager gnome-do nautilus-open-terminal vlc gimp cmus exfalso eyed3 deluge virtualbox-ose libncurses5-dev

sudo apt-get remove unity ^unity-* shotwell tomboy ubuntuone-client empathy empathy-common gwibber gwibber-service-* transmission-common

Amending vim syntax

In Compilers this semester, we’re making heavy use of a powerful Scheme match macro which includes a ,[Cata -> Id] syntax for inline calls to helper functions. However, the default vim syntax highlighting for Scheme flags -> as a syntax error, because it is an invalid identifier. It also fails to syntax-highlight match itself, and a number of other helpful macros that we’re using, like define-who.

To get around this problem without write access to the actual syntax file itself (located at /usr/share/vim/vim72/syntax/scheme.vim in the burrow) you can simply create an additional syntax file called ~/.vim/after/syntax/scheme.vim. This file will be automatically loaded after the default Scheme syntax, whenever a Schemely buffer is loaded. I put the following lines in my file:

syn keyword schemeSyntax define-who match ->
syntax region schemeMultilineComment start=/#|/ end=/|#/ contains=schemeMultilineComment

This also fixes the problem that, in the default Scheme mode, #| and |# are not treated as comment delimiters. Of course, you can add any personal macros to the list of syntax keywords.

One last problem: I’m using Aaron Hsu’s ChezWEB framework, and he uses .w as the extension for ChezWEB source files, which ought to be highlighted as Scheme source. Add this line to ~/.vimrc to load Scheme syntax whenever a .w buffer is loaded:

au BufNewFile,BufRead *.w set filetype=scheme

cmus and TPE2

In the past few weeks, I’ve switched audio players from Songbird to cmus, an ncurses-based console player. I know, it sounds ridiculous, but hear me out:

cmus music player

cmus has vi-style key bindings: j/k are down/up, :q quits, etc. It opens instantly, is very responsive, and has a small footprint. It also has support for remote commands via cmus-remote, and even has a plugin. If Linux is your primary operating system and you like the terminal, you should give it a try.

It even has a Debian package, but unfortunately, stable is back at version 2.2.0, and the current version (2.3.3) has some significant improvements. I compiled the new version, which links with a lot of codec libraries I had to download (libao2, libflac, libwavpack, libvorbis…).

But I ran into a weird issue where some albums’ artists were showing up as blank or weird garbage strings instead of the correct names; Songbird didn’t have this issue. I’m an obsessive music tagger, so this really upset my sensibilities.

cmus 2.3.3 displays the Album Artist field rather than the Artist, in order to better handle compilations. (This is reasonable, because it sorts by Album second, so it is preferable if each album is only under one artist name.) In the ID3 spec, the TPE1 field represents a “lead artist,” and is typically interpreted as the Artist field; TPE2 is the “band/orchestra/accompaniment” field, but is often interpreted as the Album Artist (most notably, by iTunes).

There is a dearth of good ID3 tag editing software, especially on Linux. I primarily use EasyTAG, but it doesn’t support editing TPE2! When a track doesn’t have a TPE2 field, cmus goes by the TPE1 field, and all is well. However, when a file has weird stuff already in TPE2, I get random garbage in cmus.

I fixed this by using mid3v2, a command-line program that allows editing any ID3v2 frame. I can simply type

mid3v2 –TPE2 “Transatlantic” ~/Music/SMTPe/*.mp3

and it solves my tagging problem! It took me a while to figure out exactly what was going on, but now everything is going smoothly. I might switch from EasyTAG to Ex Falso, a GTK-based tag editor (based, like mid3v2, on the Mutagen library) which looks a lot more featureful.