<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>Strange Loopiness</title>
      <link>http://www.zedlopez.com/strangeloopiness/</link>
      <description></description>
      <language>en</language>
      <copyright>Copyright 2010</copyright>
      <lastBuildDate>Sun, 07 Mar 2010 21:09:26 -0800</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=4.12</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

      
      <item>
         <title>The first n things to do after installing an Ubuntu command-line system, where n is large</title>
         <description><![CDATA[<p>This is my guide to how to install Ubuntu. There aren't many like it, because this one is mine. This is using Karmic and for a single-user computer.</p>

<p>I start with the alternate install <span class="caps">CD, </span>and install a command-line system. There's a lot of talk about how Ubuntu is bloated, which is a little silly, as Ubuntu is not the same thing as the ubuntu-desktop metapackage. The command-line system will leave you with a few things you won't need -- it includes the tools for several filesystems, including <span class="caps">NTFS, </span>and support for various hardware, some of which you won't have. I don't doubt that there are leaner minimalist distributions, but it's a stretch to call this bloated.</p>

<p>Toward keeping it unbloated, the first step is turning off the automatic installation of recommended packages:</p>

<p><tt>echo 'APT::Install-Recommends "false";' | sudo tee &gt; /etc/apt/apt.conf.d/02notrecommended</tt></p>

<p>Then I install the first tools I want:</p>

<p><tt>sudo apt-get install wajig zile</tt></p>

<p>That's the last we'll see of apt-get, as wajig is my preferred front end to the Debian package manager. zile is a small Emacs-workalike. Next, I make sure it gets used whenever anything needs an editor (and that I never, ever get dumped into vi):</p>

<p><tt>sudo update-alternatives --install /usr/bin/vi vi /usr/bin/zile 99<br />
sudo update-alternatives --config editor</tt></p>

<p>The latter will prompt me to choose among installed editors; I pick zile.</p>

<p>Now I'm ready to configure sudo.</p>

<p><tt>sudo visudo</tt><br />
                                               <br />
I add to the line beginning <tt>Defaults        env_reset</tt>, making it:</p>

<p><tt>Defaults        env_reset,insults,!tty_tickets</tt></p>

<p>!tty_tickets makes the sudo timeout global, instead of on a per-session basis, so that if I sudo in one window, and, soon after, sudo in another, I won't have to type my password again. This is very useful. insults means sudo will insult me if I type my password wrong. This isn't useful except inasmuch as it amuses the 12-year-old in me.</p>

<p>Next is configuring my repository sources:</p>

<p><tt>sudo -e /etc/apt/sources.list</tt></p>

<p>This boils down to these four lines, with my <a href="http://www.zedlopez.com/strangeloopiness/2008/09/fastest_ubuntu_mirror_for_you.html">closest mirror</a> substituted for "us.archive.ubuntu.com"</p>

<p><tt>deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse<br />
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted universe<br />
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse<br />
deb http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse</tt></p>

<p>plus I keep the default last few lines:</p>

<p><tt>deb http://security.ubuntu.com/ubuntu karmic-security main restricted<br />
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted<br />
deb http://security.ubuntu.com/ubuntu karmic-security universe<br />
deb-src http://security.ubuntu.com/ubuntu karmic-security universe<br />
deb http://security.ubuntu.com/ubuntu karmic-security multiverse<br />
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse</tt></p>

<p>I make sure I'm up-to-date:</p>

<p><tt>sudo wajig update<br />
sudo wajig upgrade<br />
sudo wajig dist-upgrade<br />
</tt></p>

<p>Now it's time to install everything related to one of my most important tools, ssh:</p>

<p><tt>sudo wajig install ssh denyhosts molly-guard sshfs yafc keychain<br />
sudo -e /etc/ssh/sshd_config<br />
</tt></p>

<p>I modify /etc/hosts to assign shortcuts to several of my most-used machines.</p>

<p>I set "PermitRootLogin no" (even though I don't have a root password, so no one could login as root anyway), and "PasswordAuthentication no" to disable login by password altogether -- it'll require public key authentication.</p>

<p><tt>sudo adduser zed fuse</tt></p>

<p>sshfs is an amazingly useful tool that lets you mount remote filesystems over ssh so they're transparently accessibly as if they were local. But you have to add yourself to the fuse group (and it won't take until you logout and log back in.) I like to drop this in /usr/local/bin/mkmnt as a convenience to make the mount points I'll use with it:</p>

<p><tt>#!/bin/bash<br />
for i in $@<br />
do<br />
  mkdir /mnt/$i<br />
  chown root:fuse /mnt/$i<br />
  chmod 775 /mnt/$i<br />
done</tt></p>

<p>Finally:</p>

<p><tt>sudo chown root:fuse /mnt</tt><br />
<tt>sudo chmod 775 /mnt</tt></p>

<p>I used to configure denyhosts to make it more restrictive and quicker to ban, but I don't bother anymore. The defaults are reasonable. molly-guard is there to prevent accidentally shutting down or rebooting my machine when I'm logged in remotely. yafc is a much-improved sftp, with tab-completion. And keychain lets me type my ssh private key password just once. I just add this to my .bashrc:</p>

<p><tt>eval `keychain --eval --nogui -Q -q id_rsa`</tt></p>

<p>And I install my private and public keys in my .ssh directory.</p>

<p>Now we're ready to install X.</p>

<p><tt>sudo wajig install hal xorg nvidia-glx-185 nvidia-settings xdm msttcorefonts ttf-liberation ttf-droid xscreensaver</tt></p>

<p>This gets you a whole raft of video and input packages, most of which you don't need, but is a lot faster and easier than picking out the ones you do.</p>

<p>Now it's time to start building packages from source.</p>

<p><tt>sudo wajig install build-essential automake m4 subversion git-core fakeroot checkinstall libtool texinfo texinfo-doc-nonfree manpages-dev<br />
sudo wajig build-depend ratpoison<br />
sudo wajig build-depend rxvt-unicode-ml</tt></p>

<p>I like to do my building from source under /usr/local/src, so I'll make that a little easier:</p>

<p><tt>chmod -R root:admin /usr/local<br />
chown -R 775 /usr/local</tt></p>

<p>First, ratpoison:</p>

<p><tt>cd /usr/local/src<br />
git clone git://git.savannah.nongnu.org/ratpoison.git<br />
cd ratpoison<br />
autoreconf<br />
automake --add-missing<br />
autoreconf<br />
</tt></p>



<p>I put a <a href="http://www.mail-archive.com/ratpoison-devel@nongnu.org/msg00961.html">patch of my own</a> into title_changed.patch, and apply it, then build the Debian package:</p>

<p><tt>patch -p1 &lt; title_changed.patch<br />
fakeroot debian/rules binary</tt></p>

<p>This drops a .deb into /usr/local/src, and I install it:</p>

<p><tt>cd /usr/local/src<br />
sudo wajig install ratpoison_1.4.6~git-0_i386.deb</tt></p>

<p>Next comes rxvt-unicode. I'm still in /usr/local/src...</p>

<p><tt>wget http://dist.schmorp.de/rxvt-unicode/rxvt-unicode-9.07.tar.bz2<br />
tar xjf rxvt-unicode-9.07.tar.bz2<br />
cd rxvt-unicode-9.07<br />
./configure --prefix=/usr<br />
make<br />
sudo checkinstall --fstrans=no<br />
</tt></p>

<p>I use the name 'rxvt-unicode-ml', the same as Ubuntu normally uses for the full rxvt-unicode, the description 'rxvt-unicode-ml', and the version '9.07-1source'. Per the contents of urxvtc's man page, I put this in /usr/local/bin/urxvt:</p>

<p><tt>#!/bin/sh<br />
urxvtc "$@"<br />
if [ $? -eq 2 ]; then<br />
  urxvtd -q -o -f<br />
  urxvtc "$@"<br />
fi<br />
</tt></p>

<p>And that's what I define as my x-terminal-emulator:</p>

<p><tt>sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/urxvt 99</tt></p>

<p>Now I can remove xterm. This'll take the xorg metapackage with it, but that's fine -- it's just a metapackage and all the stuff it installed will still be there.</p>

<p><tt>sudo wajig remove xterm</tt></p>

<p>Oh, so close. Now, per the xsession man page, I put this in /etc/X11/Xsession.d/35&#215;11-custom_xmodmap --</p>

<p><tt><span class="caps">SYSMODMAP</span>="/etc/X11/Xmodmap"<br />
<span class="caps">USRMODMAP</span>="$HOME/.xmodmap"</p>

<p>if [ -x /usr/bin/X11/xmodmap ]; then<br />
 if [ -f "$SYSMODMAP" ]; then<br />
   xmodmap "$SYSMODMAP"<br />
 fi<br />
 if [ -f "$USRMODMAP" ]; then<br />
  xmodmap "$USRMODMAP"<br />
 fi<br />
fi<br />
</tt></p>

<p>Then I populate /etc/X11/Xmodmap, ~/.Xresources, .ratpoisonrc, and put this in .xsession:</p>

<p><tt>xscreensaver-command -exit<br />
xscreensaver &amp;<br />
x-window-manager<br />
</tt></p>

<p>And now we're ready to run X. It's that easy.</p>

<p><tt>sudo invoke-rc.d xdm start</tt></p>

<p>I edit .xscreensaver to set 'splash: False', and run</p>

<p><tt>xscreensaver-demo</tt></p>

<p>so I can set the Mode to 'Blank Screen Only', turn on Display Power Management, and turn off 'Fade to Black when Blanking'. There are many beautiful xscreensaver hacks, but some of them create appreciable system load. I'm running it for security.</p>

<p><span class="caps">OK, </span>now for some miscellany. apt-file can do some tricks wajig can't.</p>

<p><tt>sudo wajig install apt-file<br />
sudo apt-file update</tt></p>

<p><tt>most</tt> is my preferred pager.</p>

<p><tt>sudo wajig install most<br />
sudo update-alternatives --config pager</tt></p>

<p>Really, the whole point of the exercise is Emacs.</p>

<p><tt>sudo wajig install emacs23 emacs-goodies-el python-mode yaml-mode</tt></p>

<p>I like Ruby, Perl, and Nethack. Someday I will ascend.</p>

<p><tt>sudo wajig install ruby-full ruby-elisp rubygems perl-doc nethack-el</tt></p>

<p>Some other important command-line tools:</p>

<p><tt>sudo wajig install screen ack-grep</tt></p>

<p>ack-grep's intended name is ack, but that's taken in the Debian world, so I uncomment this in the default .bashrc:</p>

<p><tt>if [ -f ~/.bash_aliases ]; then<br />
    . ~/.bash_aliases<br />
fi</tt></p>

<p>And into .bash_aliases goes:</p>

<p><tt>alias ack="ack-grep"</tt></p>

<p>Being able to unpack things is good:</p>

<p><tt>sudo wajig install atool unrar unzip</tt></p>

<p>Put this in ~/.atoolrc:</p>

<p><tt>use_rar_for_unpack 0</tt></p>

<p>The web is pretty important:</p>

<p><tt>sudo wajig install firefox epdfview privoxy</tt></p>

<p>Privoxy is a filtering web proxy.</p>

<p><tt>cd /tmp<br />
wget http://neilvandyke.org/privoxy-rules/neilvandyke.action<br />
sudo mv /tmp/neilvandyke.action /etc/privoxy<br />
sudo -e /etc/privoxy/config<br />
</tt></p>

<p>Between actionsfile default.action and actionsfile user.action, I add:</p>

<p><tt>actionsfile neilvandyke.action</tt></p>

<p>In user.action, I add some more sites, as well as define some sites on which to not block ads.</p>

<p>I get the Flash 10.1 beta:</p>

<p><tt>cd /tmp<br />
wget http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_1_p3_linux_022310.tar.gz<br />
tar xzf flashplayer10_1_p3_linux_022310.tar.gz<br />
mkdir ~/.mozilla/plugins<br />
mv libflashplayer.so ~/.mozilla/plugins<br />
</tt></p>

<p>Sound starts out set to zero, so I need alsamixer to turn it up:</p>

<p><tt>sudo wajig install alsa-utils<br />
alsamixer</tt></p>

<p>Get and install the forbidden packages:</p>

<p><tt><br />
cd /tmp<br />
wget http://packages.medibuntu.org/pool/non-free/w/w32codecs/w32codecs_20071007-0medibuntu5_i386.deb<br />
wget http://packages.medibuntu.org/pool/free/libd/libdvdcss/libdvdcss2_1.2.10-0.3medibuntu1_i386.deb<br />
sudo wajig install w32codecs_20071007-0medibuntu5_i386.deb<br />
sudo wajig install libdvdcss2_1.2.10-0.3medibuntu1_i386.deb<br />
</tt></p>

<p><a href="http://venutip.com/content/installing-vista-fonts-ubuntu">Install the fonts from Powerpoint.</a> </p>

<p>Monitoring is good. This includes:</p>

<p><tt>sudo wajig install lm-sensors htop iftop iotop hddtemp smartmontools</tt></p>

<p>Virtual machines are fun.</p>

<p><tt>sudo wajig install qemu kvm</tt></p>

<p>Downloader helpers.</p>

<p><tt>sudo wajig install transmission-cli axel</tt></p>

<p>Multimedia.</p>

<p><tt>sudo wajig install mplayer-nogui flac vorbis-tools vorbisgain feh</tt></p>

<p>Into every life some Microsoft Word docs must fall.</p>

<p><tt>sudo wajig install antiword</tt></p>

<p>Keep the computer time synced with atomic clocks:</p>

<p><tt>sudo wajig install ntp</tt><br />
<tt>sudo -e /etc/ntp.conf</tt></p>

<p>I remove the 'server ntp.ubuntu.com' line and replace it with:</p>

<p><tt>server 0.north-america.pool.ntp.org<br />
server 1.north-america.pool.ntp.org<br />
server 2.north-america.pool.ntp.org<br />
server 3.north-america.pool.ntp.org<br />
</tt></p>

<p>I like TeX, and LaTeX, and ConTeXt and printing things.</p>

<p><tt>sudo wajig install context texlive-latex-extra gv texlive-latex-extra-doc texlive-latex-base-doc cups-client texlive-latex-recommended texlive-latex-recommended-doc</tt></p>

<p>That may seem like a lot, and it is, but it's still not much compared to texlive-full.</p>

<p>I just need a client to a Cups server running elsewhere on my local network, so I just need to populate /etc/cups/client.conf:</p>

<p><tt>ServerName hostname_of_cups_server</tt></p>

<p>I want to access a Samba server on my local network, so:</p>

<p><tt>sudo wajig install smbfs<br />
mkmnt smbmountpoint<br />
</tt></p>

<p>I add this to /etc/fstab:</p>

<p>//smbhostname/Volume_1 /mnt/smbmountpoint cifs credentials=/etc/smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777,noperm 0 0</p>

<p>/etc/smbcredentials is of the form:</p>

<p><tt>username=smbusername<br />
password=smbpassword</tt></p>

<p>Then I just:</p>

<p><tt>sudo mount -a</tt></p>

<p>I've skimped on configuring Firefox, Emacs, urxvt, and on talking about the contents of my .Xresources, .Xmodmap, and .ratpoisonrc, as well as the other little scripts I put in /usr/local/bin. Maybe next time.</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2010/03/what_i_do_after_installing_ubu.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2010/03/what_i_do_after_installing_ubu.html</guid>
         <category></category>
         <pubDate>Sun, 07 Mar 2010 21:09:26 -0800</pubDate>
      </item>
      
      <item>
         <title>Manually mounting whole disk encryted drive</title>
         <description><![CDATA[<p>The Debian installer (which I've been using with the Ubuntu Alternate Install CD for years) makes it easy to set up whole disk crypto with cryptsetup, <span class="caps">LUKS, </span>and <span class="caps">LVM.</span> So easy that it's easy to forget how to get to the info when you're not longer booting the disk, but are accessing it in an external drive. So here's a reminder of how to do it when it's <span class="caps">LVM </span>over a <span class="caps">LUKS </span>encrypted partition. <tt>ls dev</tt> or <tt>dmesg</tt> to get the device name of the encrypted partition. Let's say it was <tt>/dev/sdb1</tt>.</p>

<p><tt>sudo cryptsetup luksOpen /dev/sdb1 arbitraryname</tt></p>

<p><tt>sudo lvscan</tt></p>

<p>This'll give you the name of the logical volumes as they were originally set up. Let's say the one you're interested in was <tt>/dev/myvolumegroup/root</tt>.</p>

<p>You're almost there; all you have to do is make a mount point, e.g., <tt>/mnt/lvroot</tt> and:</p>

<p><tt>sudo mount /dev/myvolumegroup/root /mnt/lvroot</tt></p>

<p>Ta da.</p>

<p><b>Updated:</b> One may have to load some kernel modules before the luksOpen, e.g., </p>

<p><tt>modprobe dm_mod<br />
modprobe dm_crypt<br />
modprobe aes</tt></p>

<p>And mark the logical volume and/or volume group active:</p>

<p><tt>lvchange -ay logical_volume_name<br />
vgchange -ay volume_group_name</tt></p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2010/02/manually_mounting_whole_disk_e.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2010/02/manually_mounting_whole_disk_e.html</guid>
         <category></category>
         <pubDate>Sat, 27 Feb 2010 15:12:20 -0800</pubDate>
      </item>
      
      <item>
         <title>Chromium: useless (to me, for now)</title>
         <description><![CDATA[<p>I've been frustrated with Firefox grinding to a halt over time, and needing restarting. I've heard tell that Google's <a href="http://www.chromium.org/">Chromium browser</a> is much faster on Linux, so I thought I'd try it.</p>

<p>It took as long as the first time I tried to type something in a text field to be bit by <a href="http://code.google.com/p/chromium/issues/detail?id=24583">this bug.</a> The X Window System supports essentially a second shift key, called mode_switch. The other keys can have different definitions for all four of their unmodified, shifted, mode_switched, and shifted <em>and</em> mode_switched meanings. </p>

<p>So far as I know, most distributions don't do anything with them by default, but I use them extensively to provide, among other things, a set of cursor keys under my fingertips, without requiring moving my hands. </p>

<p>In Chromium, it's as if mode_switch is being held down all the time, so those keys can <em>only</em> produce the cursor movement, and not their normal text values, leaving me with half my keyboard missing.</p>

<p>A developer has marked it WontFix, saying it was a gtk problem that's been fixed in more recent versions. It's a problem that doesn't occur in any other gtk app; the gtk bug the developer cited as responsible is clearly unrelated; and I tried updating my gtk with no effect.</p>

<p>I'll try delving into the code myself, but <a href="http://www.zedlopez.com/strangeloopiness/2008/09/xterm_made_easy.html">this</a> is the extent of my gtk experience.</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2010/01/chromium_useless_to_me_for_now.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2010/01/chromium_useless_to_me_for_now.html</guid>
         <category></category>
         <pubDate>Sat, 02 Jan 2010 12:50:14 -0800</pubDate>
      </item>
      
      <item>
         <title>Civilization in Wine on Linux. How civilized.</title>
         <description><![CDATA[<p>I have the Civilization IV: the Complete Edition <span class="caps">DVD </span>sans <span class="caps">DRM.</span> It works pretty well under Wine. But this is what it took (Ubuntu 8.10, aka Intrepid):</p>

<p>I find it makes life easier to segregate my Wine apps, so first steps were:</p>


<pre>export WINEPREFIX=/usr/local/civ
winecfg</pre>



<p>There, I set Wine to also consider /usr/local/civ to be where my My Documents folder was, so the game would create its "My Games" folder there instead of under my real Linux home directory.</p>

<p><a href="http://wine.budgetdedicated.com/archive/ubuntu/intrepid/wine_1.1.22~winehq0~ubuntu~8.10-0ubuntu1_i386.deb">Wine 1.1.22.</a> It failed with Wine 1.1.23, the current development release.<br />
Used <a href="http://winezeug.googlecode.com/svn/trunk/winetricks">winetricks</a> to install d3dx9 and msxml3<br />
Needed <a href="http://ubuntuforums.org/showthread.php?t=282051">this</a> to get around a stupid sound bug:</p>



<pre>mkdir -pv $HOME/.kde/socket-$HOSTNAME</pre>



<p>Then just running </p>

<pre>wine setup.exe</pre>

<p> on the file at the top level of the <span class="caps">DVD </span>did the rest. I selected "custom install" so I could set a less long, obnoxious installation path than the default. I installed the just-released <a href="http://www.firaxis.com/downloads/Patch/Civ4BeyondTheSwordPatch3.19.exe">Beyond the Sword 3.19 patch.</a></p>

<p>I put <a href="http://www.civfanatics.net/bluemarble/content/index.php">Blue Marble</a> on top of that, and ran vanilla Civ, Warlords, Beyond the Sword, and Colonization once each to create the appropriate folders under My Games, and to set the graphics and audio options to my preferences.</p>

<p>I edited each of the CivilizationIV.ini files in their respective directories under the installation directories to set NoIntroMovie = 1 and EnableVoice = 0. (The first is just by preference; the intro movies worked fine. The default EnableVoice = 1 resulted in a warning under Warlords, but not the others. Strange.) It didn't work to set these just in the CivilizationIV.ini files under My Games, which I would have thought was the point.</p>

<p>Finally, I backed up the results so I won't have to do all that again when I inevitably screw something up while playing with <a href="http://forums.civfanatics.com/downloads.php?do=cat&amp;id=1">mods.</a></p>

<p>The startup scripts are simply like this:</p>


<pre>#!/bin/bash
WINEPREFIX=/usr/local/civ 
/usr/bin/wine /usr/local/civ/drive_c/Program\ Files/civ4complete/Civilization4.exe $@</pre>



<p>Everything but a few cosmetic details works. Unit health bars don't, city progress bars on the main map don't (this can be ameliorated by requesting detailed city info in the options), the cursor animation doesn't work, so it doesn't turn into a little spinning globe when you're waiting. So far as I can tell, everything else works. (And my words are backed by a Holy Roman spaceship at Alpha Centauri.)</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2009/06/civilization_in_wine_on_linux.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2009/06/civilization_in_wine_on_linux.html</guid>
         <category></category>
         <pubDate>Sun, 14 Jun 2009 17:21:31 -0800</pubDate>
      </item>
      
      <item>
         <title>Ruby string escaping weirdness</title>
         <description><![CDATA[<p>Well, that's odd... (ruby 1.8.7)</p>



<pre>
irb(main):021:0&gt; '\\' + 'x'
=&gt; &quot;\\x&quot;
irb(main):022:0&gt; &quot;x&quot;.gsub(&quot;x&quot;,'\\' + 'x')
=&gt; &quot;\\x&quot;
irb(main):023:0&gt; '\\' + '&amp;'
=&gt; &quot;\\&amp;&quot;
irb(main):024:0&gt; &quot;&amp;&quot;.gsub(&quot;&amp;&quot;,'\\' + '&amp;')
=&gt; &quot;&amp;&quot;
</pre>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2009/06/ruby_string_escaping_weirdness.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2009/06/ruby_string_escaping_weirdness.html</guid>
         <category></category>
         <pubDate>Fri, 12 Jun 2009 18:36:15 -0800</pubDate>
      </item>
      
      <item>
         <title>Recycling Palms as secondary LCD displays</title>
         <description><![CDATA[<p>Recently, I&#8217;ve had a crush on the computer lcd front panel displays you can find <a href="http://www.crystalfontz.com/products/index-usb.html">here</a> or <a href="http://www.matrixorbital.com/">here</a>. But they&#8217;re either tiny or expensive.</p>

<p>I remembered a project to let you use a Palm in its cradle as an LCD display. <a href="http://palmorb.sourceforge.net/">PalmOrb</a> has been orphaned since 2005, and, as of the last version, indicates you&#8217;re on your own with USB Palms (which are the only ones I have left.) It actually worked decently with <a href="http://ssl.bulix.org/projects/lcd4linux/">LCD4Linux</a>. But it only left you with a tiny block of text, and it was harder than I&#8217;d like to customize the output.</p>

<p>So I tried simply running <a href="http://netpage.estaminas.com.br/mmand/ptelnet.htm">ptelnet</a>, a Palm telnet app, to make a serial connection, and running a script that wrote to /dev/pilot (I had the visor module loaded), clearing the screen every minute (with VT100 escape codes) and sending status info.</p>

<p>It works pretty well, but the text is tiny, with no way to change the size. Anyone know of an alternative to ptelnet to just receive data from the serial connection and display it, that allows you to change fonts?</p>
]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2009/03/recycling_palms_as_secondary_l.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2009/03/recycling_palms_as_secondary_l.html</guid>
         <category></category>
         <pubDate>Tue, 03 Mar 2009 10:14:14 -0800</pubDate>
      </item>
      
      <item>
         <title>New and improved emacs launcher</title>
         <description><![CDATA[<p>I'm much happier with this combination. /usr/local/bin/editor is:</p>

<code>
#!/bin/bash
ALTERNATE_EDITOR=/usr/local/bin/editor2 emacsclient -c &quot;$*&quot;
</code>

<p>/usr/local/bin/editor2 is:<br />
#!/bin/bash<br />
<span class="caps">EMACS</span>=/usr/bin/emacs<br />
<span class="caps">EMACSCLIENT</span>=/usr/bin/emacsclient<br />
<span class="caps">SOCKET</span>=/tmp/emacs`id -u`/server</p>

<p>$EMACS --daemon</p>

<p>count=25</p>

<p>while [ $[ count-- ] -gt 0 ]; do<br />
  if [ -e $SOCKET ] &amp;&amp; [ ! (lsof $SOCKET &amp;&gt; /dev/null) ]; then <br />
      $EMACSCLIENT -c "$*"<br />
      break<br />
  fi<br />
  sleep .2<br />
done<br />
</code></p>

<p>Among the advantages here over the old one:</p>

<p>emacs --daemon is only run if emacsclient can't find a socket, as opposed to emacsclient encountering any error</p>

<p>The old one slept for 1 second after launching the daemon. This was occasionally too short, but usually too long. This one checks for the socket five times a second, and gives up after five seconds. (There are imaginable race conditions that could give undesirable results, but I don't expect to ever actually encounter them.)</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2009/02/new_and_improved_emacs_launche.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2009/02/new_and_improved_emacs_launche.html</guid>
         <category></category>
         <pubDate>Fri, 13 Feb 2009 07:02:30 -0800</pubDate>
      </item>
      
      <item>
         <title>Daemon Emacs</title>
         <description><![CDATA[<p>A nifty feature in the current development version  of Emacs (now available in a <a href="http://alpha.gnu.org/gnu/emacs/pretest/">pretest</a> release candidate) is that you can <a href="http://www.emacswiki.org/emacs/EmacsAsDaemon">start it as a daemon</a>, to which graphical and terminal clients alike can attach. A not so nifty lack of feature is there being no easy standard way to do the obvious: launch a client if the daemon's running; if it's not, start the daemon, and then launch the client. So everyone cobbles together their own. Here's mine, which cribs from <a href="http://remi.vanicat.free.fr/blog/index.php/general/2008/03/21/trying-to-launch-emacs-only-when-needed/">here.</a></p>

<p><tt>#!/bin/bash<br />
if [ -z $DISPLAY ] ; then<br />
  <span class="caps">OPT</span>="-t"<br />
else<br />
  <span class="caps">OPT</span>="-c"<br />
fi</p>

<p>if [ -z "$*" ]; then<br />
  <span class="caps">OPT</span>="$OPT -e (raise-frame)"<br />
else<br />
  <span class="caps">OPT</span>="$OPT $@"<br />
fi<br />
emacsclient $OPT 2&gt;/dev/null || (<br />
	(emacs --daemon)<br />
	sleep 1<br />
	emacsclient $OPT)</tt></p>

<p>I have that as /usr/local/bin/editor. To stop emacs nicely, and get prompted to save unfinished business, I have another script with:</p>

<p><tt>/usr/local/bin/editor -e '(save-buffers-kill-emacs)'</tt></p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2009/02/daemon_emacs.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2009/02/daemon_emacs.html</guid>
         <category></category>
         <pubDate>Tue, 03 Feb 2009 14:24:51 -0800</pubDate>
      </item>
      
      <item>
         <title>My own virtual Ubuntu Intrepid</title>
         <description><![CDATA[<ol>
<li><p>Make sure your CPU supports virtualization (you may have to turn it on in the BIOS)</p>

<p><code>cat /proc/cpuinfo |egrep '(svm|vmx)'</code></p>

<p>If you get no response, it doesn't. A response means you're good to go.</p></li>
<li><p>Download the Ubuntu Intrepid Beta alternate install CD</p></li>
<li><p>install qemu and kvm</p>

<p><code>sudo apt-get install qemu kvm</code></p></li>
<li><p>create the disk image that will serve as the virtualized intrepid's hard drive</p>

<p><code>qemu-img create -f qcow2 intrepid.img 6G</code></p></li>
<li><p>start the vm, booting the Intrepid CD</p>

<p><code>sudo kvm -cdrom ubuntu-8.10-beta-alternate-i386.iso -hda intrepid.img -boot d -m 256M</code></p></li>
<li><p>Hit F4 to choose a command-line install; go through the installation.</p></li>
<li><p>When the installation finishes and reboots, kill the VM. Restart it with:</p>

<p><code>sudo kvm -hda qemu/intrepid.img -boot c -m 256M -redir tcp:2222::22 &amp;</code></p></li>
<li><p>In the VM, turn off apt-get automatically installing recommended packages</p>

<p><code>echo  'APT::Install-Recommends "false";'|sudo tee /etc/apt/apt.conf</code></p></li>
<li><p>In the VM, Edit /etc/apt/sources.list to point to the closest mirror</p></li>
<li><p>In the VM, Bring yourself up-to-date and install openssh-server</p>

<p><code>sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server</code></p></li>
<li><p>On your real machine, ssh into the VM.</p>

<p><code>ssh -p 2222 username@localhost</code></p></li>
<li><p>Have fun with your new virtual Intrepid.</p></li>
</ol>
]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2008/10/my_own_virtual_ubuntu_intrepid.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2008/10/my_own_virtual_ubuntu_intrepid.html</guid>
         <category></category>
         <pubDate>Mon, 13 Oct 2008 22:11:57 -0800</pubDate>
      </item>
      
      <item>
         <title>xterm made easy</title>
         <description><![CDATA[<p>I&#8217;m a fan of the <a href="http://software.schmorp.de/pkg/rxvt-unicode.html">rxvt-unicode</a> terminal emulator, but it has one problem: it sometimes spaces xft fonts badly, with conspicuous gaps between the characters, making for fewer characters per line.</p>

<p>Looking into alternatives, I found that the GTK library includes vte, a terminal emulator widget that a <a href="http://www.calno.com/evilvte/">bunch of terminal emulators</a> use. And they all look good, but had a drawback I couldn&#8217;t live with: none of the ones I tried recognized my Meta-keys, which I&#8217;ve grown used to using for command-line editing in my shell.</p>

<p>vte, along with the Ruby GTK bindings, makes life so easy, I just rolled my own. This is just the Ruby vte demo program that comes with the bindings with a couple of lines added to handle Meta-keys.</p>

<pre><code>require "vte"

window = Gtk::Window.new("Terminal sample")
window.signal_connect("destroy"){Gtk.main_quit}

vte = Vte::Terminal.new
vte.set_font("DejaVu Sans Mono 16", Vte::TerminalAntiAlias::FORCE_ENABLE)

Gtk.key_snooper_install {|t, e| 
  vte.feed_child("\e")  if e.state.meta_mask? and e.event_type == Gdk::Event::KEY_PRESS
}

vte.signal_connect("child-exited") do |widget|
  Gtk.main_quit
end
vte.signal_connect("window-title-changed") do |widget|
  window.title = vte.window_title
end
vte.fork_command
window.add(vte)
window.show_all

Gtk.main
</code></pre>
]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2008/09/xterm_made_easy.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2008/09/xterm_made_easy.html</guid>
         <category></category>
         <pubDate>Mon, 22 Sep 2008 07:12:29 -0800</pubDate>
      </item>
      
      <item>
         <title>Fastest Ubuntu mirror for you</title>
         <description><![CDATA[<p>I recently learned about <a href="http://www.debiantoday.com/get-more-from-apt/">netselect-apt</a>, a Debian package to find the fastest Debian mirror. Ubuntu Hardy includes it, but it's worse than useless -- it's still hard-coded to work with Debian. But it's easy enough to reproduce its essential functionality.</p>

<p><tt>
sudo apt-get install netselect<br />
wget --no-check-certificate -O mirrors https://launchpad.net/ubuntu/+archivemirrors<br />
sudo netselect -v -s 5 $(perl -F'"' -ane 'print "$F[1] " if (/United States/ .. /highlighted/) &amp;&amp; /http/' mirrors)<br />
</tt></p>

<p>That gives the top 5 (from fastest to slowest) in the US using http. It should be reasonably clear how to adjust the number returned, the country, or the protocol (which could be 'ftp' or 'rsync'.) It erroneously considers canonical.com a mirror in Viet Nam (it fails to find the end correctly for the last country in the list), but there's only one mirror in Viet Nam, and this is a quick hack, so I can live with that.</p>
]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2008/09/fastest_ubuntu_mirror_for_you.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2008/09/fastest_ubuntu_mirror_for_you.html</guid>
         <category></category>
         <pubDate>Tue, 16 Sep 2008 19:18:20 -0800</pubDate>
      </item>
      
      <item>
         <title>PDF Viewer</title>
         <description><![CDATA[<p>I don't use a <a href="http://en.wikipedia.org/wiki/Desktop_environment">desktop environment;</a> I use an <a href="http://freshmeat.net/articles/view/581/">antidesktop environment</a> featuring the ultra-minimalist <a href="http://ratpoison.antidesktop.net">ratpoison</a> window manager and the ultra-maximalist <a href="http://emacswiki.org">Emacs.</a></p>

<p>It makes me grumpy when applications depend on installing huge portions of Gnome or <span class="caps">KDE.</span> So I was never thrilled with the <span class="caps">PDF </span>viewer choices.</p>

<p><a href="http://pages.cs.wisc.edu/~ghost/">ghostview</a> and <a href="http://www.foolabs.com/xpdf/">xpdf</a> are good tools, but ugly, and they don't natively talk to <span class="caps">CUPS </span>print servers. evince and kpdf want to install huge portions of Gnome and <span class="caps">KDE, </span>respectively. I haven't tried acroread, but I scramble for alternative's to Adobe's bloated reader in Windows, so I thought I'd spare myself.</p>

<p>So I was happy to find <a href="http://www.emma-soft.com/eblog/category/epdfview/">epdfview,</a> which shares some of evince's dependencies on graphics libraries without the gratuitous dependencies.</p>

<p>But there was a catch: Ubuntu 8.04's binary package doesn't include <span class="caps">CUPS </span>support, for no apparent reason (there's already a <a href="https://bugs.launchpad.net/ubuntu/+source/epdfview/+bug/239459">bug</a> filed.) The good news is that you can build it yourself.</p>

<p>So I'm now a happy viewer and printer of <span class="caps">PDF</span>s while still avoiding having dbus, gamin, bonobo, etc., installed.</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2008/06/pdf_viewer.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2008/06/pdf_viewer.html</guid>
         <category></category>
         <pubDate>Wed, 18 Jun 2008 22:16:27 -0800</pubDate>
      </item>
      
      <item>
         <title>First look at Ubuntu Gutsy Beta</title>
         <description><![CDATA[<p>The forthcoming Ubuntu release, <a href="http://www.ubuntu.com/testing/gutsybeta">7.10, the Gutsy Gibbon,</a> is <a href="https://wiki.ubuntu.com/GutsyReleaseSchedule">scheduled for release</a> next month, 10/18. I recently tried installing it, and quickly encountered <a href="https://bugs.launchpad.net/ubuntu/+source/udev/+bug/145382">this bug,</a> reported as fixed yesterday.</p>

<p>Ubuntu had inherited from Debian a <a href="http://www.debian-administration.org/articles/502">problem</a> whereby  network interfaces' names can be inconsistent from one reboot to the next. The installer identified my mobo's wired network interface as eth1. On rebooting, the OS decided it was eth2, but /etc/network/interfaces had been configured to use the (now non-existent) eth1, hence no network.</p>

<p>In days' past, I've used <a href="http://www.stuvel.eu/archive/26/ethernet-numbering-in-ubuntu">/etc/iftab</a> to ensure it didn't recur, but, apparently, <a href="https://wiki.ubuntu.com/BugSquad">as of Gutsy,</a> this approach is deprecated, and the shiny new method is to use <a href="http://obsidianlake.blogspot.com/2007/08/persistent-network-interfaces-eth.html">udev.</a></p>

<p>I then spent much time bashing my head against trying to arrange to boot into an encrypted root filesystem within an <a href="http://tldp.org/HOWTO/LVM-HOWTO/whatislvm.html"><span class="caps">LVM2</span></a> logical volume on an encrypted <a href="http://luks.endorphin.org/"><span class="caps">LUKS</span></a> partition, similar to <a href="https://help.ubuntu.com/community/EncryptedFilesystemLVMHowto?highlight=%28encryptedfilesystem%29">this</a> but using <a href="http://yaird.alioth.debian.org/">yaird</a> to create the boot image. This is something I've done in the current Ubuntu release, Feisty. But I ran into a <a href="https://bugs.launchpad.net/ubuntu/+source/yaird/+bug/148727">couple</a> of <a href="https://bugs.launchpad.net/ubuntu/+source/yaird/+bug/148724">bugs</a> in Gutsy's yaird package. (The trivial one also existed in Feisty, but I didn't report it then.)</p>

<p>It'd be nice if Ubuntu offered an encrypted root installation option like <a href="http://www.debian.org/releases/stable/i386/ch06s03.html.en">Debian Etch,</a> but I'd probably want enough things different from any set of options offered to end up doing it manually anyway.</p>

<p>I'm pretty sure I know how to fix the problem now. But I haven't had the time to take another crack at it, so my first look has been stalled here.</p>

<p>Maybe when I'm done, I'll write <a href="https://help.ubuntu.com/community/?action=fullsearch&amp;value=encryptedfilesystem&amp;titlesearch=Titles">yet another encrypted root howto.</a></p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2007/10/first_look_at_ubuntu_gutsy_bet_1.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2007/10/first_look_at_ubuntu_gutsy_bet_1.html</guid>
         <category></category>
         <pubDate>Thu, 04 Oct 2007 06:56:56 -0800</pubDate>
      </item>
      
      <item>
         <title>Seeking Random Numbers. Must pass Chi-Square test. No freaks.</title>
         <description><![CDATA[<p>Pocahontas had some little webcam she'd gotten a while ago as a promo item for signing up with an <span class="caps">ISP.</span> For a while, I've had in the back of my mind to use it to build a <a href="http://www.lavarnd.org/what/process.html">LavaCan.</a> Because, you know, every home needs a cryptographically secure source of random numbers in hardware. Well, it seems like people were lucky to get this camera working with an allegedly <a href="http://www.computing.net/windows95/wwwboard/forum/16264.html">supported <span class="caps">OS.</span></a> This guy heroically <a href="http://jcoppens.com/globo/gl4pre/cam/index.en.php">analyzed the signal between the PC and the webcam</a> and came up with some sort of picture, but his write-up falls short of providing code.</p>

<p>Oh well. The Weecam's off to the <a href="http://www.accrc.org/">Alameda County Computer Resource Center,</a> and I'll give <a href="http://www.freewebs.com/pmutaf/iwrandom.html">iwrandom</a> a try. (But a webcam in the dark is so much cooler, drat it.)</p>]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2007/07/seeking_random_numbers_must_pa.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2007/07/seeking_random_numbers_must_pa.html</guid>
         <category></category>
         <pubDate>Tue, 03 Jul 2007 07:18:50 -0800</pubDate>
      </item>
      
      <item>
         <title>Apt-get globally, gem locally</title>
         <description><![CDATA[<p>It seems that <a href="http://pkg-ruby-extras.alioth.debian.org/rubygems.html">Debian packages and Ruby gems</a> don't play nicely together. I had apt-get installed rails, and my first attempt to use a rails app (someone else had written) blew up because it had an internal check for a Rails gem of a certain version. Since my Rails hadn't been installed as a gem at all, it immediately failed.</p>

<p>So far as I can read on the Interwebs, most people facing this install rubygems as root, and do their subsequent gem installs as root, letting them write wherever in the filesystem they like. </p>

<p>That makes me queasy. I don't want to mix two package systems in the same environment.</p>

<p>So here's how I installed ruby/rubygems/rails in Ubuntu 7.04, with all gems under /usr/local.</p>

<p>Following the ruby1.8 package's own instructions for a full Ruby 1.8 distribution:</p>

<pre><code>sudo apt-get install ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8</code></pre>

<p>I assign ownership of /usr/local and everything under it to the admin group, and make /usr/local and its subdirectories group-writable (per Ubuntu's defaults, my primary login, which I created during installation, is a member of the admin group.)</p>

<pre><code>sudo chown -R root:admin /usr/local 
sudo chmod 775 /usr/local /usr/local/*</code></pre>

<p>I get and install rubygems.</p>

<pre><code>mkdir /usr/local/lib/rubygems
export GEM_HOME=/usr/local/lib/rubygems
cd /usr/local/src
# as of this writing, the latest rubygems from http://rubyforge.org/frs/?group_id=126
wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
tar xzf rubygems-0.9.4.tgz
cd rubygems-0.9.4
ruby setup.rb config --prefix=/usr/local
ruby setup.rb setup
ruby setup.rb install</code></pre>

<p>I add the following to my .bashrc, but you'll want them in any environment using gems. With multiple users on a system, you might want to put this in /etc/bash.bashrc.</p>

<pre><code>export GEM_HOME=/usr/local/lib/rubygems
export RUBYLIB=/usr/local/site_ruby/1.8
export RUBYOPT=rubygems
export PATH=$PATH:/usr/local/lib/rubygems/bin</code></pre>

<p>The grand finale:</p>

<pre><code>source .bashrc # or wherever you put them
gem install rails --include-dependencies</code></pre>

<p>It's <em>that</em> easy!</p>

<p>References:</p>


<ul>
<li><a href="http://schf.uc.org/articles/2006/11/15/installing-mongrel-on-a-shared-host">Installing Rails and Mongrel on a Shared Host</a></li>
<li><a href="http://www.debian-administration.org/articles/329">Ruby on Rails on Debian</a></li>
<li><a href="http://rubygems.org/read/chapter/3">RubyGems User Guide, Ch. 3</a></li>
</ul>

]]></description>
         <link>http://www.zedlopez.com/strangeloopiness/2007/06/aptget_globally_gem_locally.html</link>
         <guid>http://www.zedlopez.com/strangeloopiness/2007/06/aptget_globally_gem_locally.html</guid>
         <category></category>
         <pubDate>Fri, 15 Jun 2007 22:22:35 -0800</pubDate>
      </item>
      
   </channel>
</rss>
