<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom">

  <title>CurtisFree.com Blog</title>
  <subtitle>I'm a geek, and I have the most wonderful wife in the anywhere.</subtitle>
  <icon>http://curtisfree.com/favicon.ico</icon>
  <author>
    <name>Curtis Free</name>
    <email>cf@curtisfree.com</email>
  </author>
  <link href="http://curtisfree.com/blog" />
  <link href="http://curtisfree.com/blog/feed" rel="self" />
  
  <entry>

    
    
    <title>My preferred monospace fonts</title>
    <link href="http://curtisfree.com/blog/2012/05/12/preferred_monospace_fonts" />
    <updated>2012-05-12T21:30:00-04:00</updated>
    <content type="html">
      &lt;p&gt;As a programmer and command-line enthusiast, I spend a lot of time looking at monospace fonts. For
many years, I enjoyed using what has been for years a popular default:
&lt;a href=&quot;https://en.wikipedia.org/wiki/Bitstream_Vera&quot;&gt;Bitstream Vera&lt;/a&gt; Sans Mono.&lt;/p&gt;

&lt;p&gt;A few months ago, I spent a great deal of time trying out different monospace fonts. Here, I’ll
present a brief list of my favorites; the font specification strings and screenshots represent my
preferred configuration for each of the fonts in my preferred terminal, &lt;code&gt;rxvt-unicode&lt;/code&gt;:&lt;/p&gt;

&lt;ol reversed=&quot;&quot;&gt;
  &lt;li&gt;

    &lt;a href=&quot;http://www.fial.com/~scott/tamsyn-font/&quot;&gt;Tamsyn&lt;/a&gt;
    &lt;pre&gt;-*-tamsyn-medium-r-*-*-14-*-*-*-*-*-*-*&lt;/pre&gt;
    &lt;img src=&quot;/imgs/terminal_font_tamsyn.png&quot; /&gt;

    &lt;p&gt;
      There's just something about Tamsyn that I like (in addition to
      &lt;a href=&quot;http://www.fial.com/~scott/tamsyn-font/&quot;&gt;its website&lt;/a&gt;, of which I'm a big fan).
    &lt;/p&gt;

    &lt;p&gt;
      Unfortunately, though it's a sans-serif font, the glyph shapes do seem to possess some
      &amp;ldquo;serif&amp;rdquo; qualities and seem jagged (pixelated). I'm also not a fan of the
      &amp;ldquo;sharp&amp;rdquo; &lt;i&gt;m&lt;/i&gt; and &lt;i&gt;w&lt;/i&gt; glyphs at smaller sizes (as shown). I refer to the
      &lt;i&gt;m&lt;/i&gt; as a &amp;ldquo;&lt;a href=&quot;https://mail.google.com&quot;&gt;Gmail&lt;/a&gt; &lt;i&gt;m&lt;/i&gt;.&amp;rdquo;
    &lt;/p&gt;

    &lt;p&gt;
      I &lt;i&gt;do&lt;/i&gt; use Tamsyn on my virtual consoles, as my favorite (see below) is a derivative of
      Tamsyn but is not yet available in a console-capable format.
    &lt;/p&gt;

  &lt;/li&gt;
  &lt;li&gt;

    &lt;a href=&quot;http://dejavu-fonts.org&quot;&gt;DejaVu&lt;/a&gt; Sans Mono
    &lt;pre&gt;xft:DejaVu Sans Mono:size=9&lt;/pre&gt;
    &lt;img src=&quot;/imgs/terminal_font_dejavu.png&quot; /&gt;

    &lt;p&gt;
      DejaVu Sans Mono is little more than Bitstream Vera Sans Mono &amp;ndash; so here, I'm not
      straying far from my &amp;ldquo;safe default&amp;rdquo;; but I prefer DejaVu because it supports a
      larger character set (even though, admittedly, I don't make use of it).
    &lt;/p&gt;

    &lt;p&gt;
      This is the only non-bitmap font on the list.
    &lt;/p&gt;

    &lt;p&gt;
      Among other things, this means that much of its appearance is dependent on system font
      settings. Bitmap fonts, on the other hand, are much more uniform in appearance across systems
      (though they, too, are subject to some variation). Working with multiple Linux distributions
      and OS X, DejaVu Sans Mono can look crisp or blurry &amp;ndash; or perhaps the character spacing
      might not be consistent across applications. While this is no fault of the font itself, it's
      worth noting.
    &lt;/p&gt;

    &lt;p&gt;
      I continue to use DejaVu in some terminals/on some machines; and it's my preferred font for
      displayed code (e.g., in code blocks on this page).
    &lt;/p&gt;

  &lt;/li&gt;
  &lt;li&gt;

    &lt;a href=&quot;http://terminus-font.sourceforge.net&quot;&gt;Terminus&lt;/a&gt;
    &lt;pre&gt;-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*&lt;/pre&gt;
    &lt;img src=&quot;/imgs/terminal_font_terminus.png&quot; /&gt;

    &lt;p&gt;
      Terminus is well-known in the Arch Linux community &amp;ndash; and for good reason. It's simply a
      great font. Terminus glyphs are perhaps the simplest and most readable I've seen.
    &lt;/p&gt;

    &lt;p&gt;
      You might notice that the directory names in the screenshot are not displayed in bold face:
      this size of the Terminus font has no bold face. I don't consider that a problem (in fact, I
      like the clean look of a terminal with no bold fonts); but others might.
    &lt;/p&gt;

    &lt;p&gt;
      Terminus is &amp;ldquo;tied&amp;rdquo; with DejaVu as my favorite for use on some systems.
    &lt;/p&gt;

  &lt;/li&gt;
  &lt;li&gt;

    &lt;a href=&quot;https://bbs.archlinux.org/viewtopic.php?id=130912&quot;&gt;Termsyn&lt;/a&gt;
    &lt;pre&gt;-*-termsyn-medium-r-*-*-14-*-*-*-*-*-*-*&lt;/pre&gt;
    &lt;img src=&quot;/imgs/terminal_font_termsyn.png&quot; /&gt;

    &lt;p&gt;
      Termsyn is a middle-ground between &lt;i&gt;Term&lt;/i&gt;inus and Tam&lt;i&gt;syn&lt;/i&gt;.
    &lt;/p&gt;

    &lt;p&gt;
      Termsyn is probably the least popular on the list, but it's my default font in
      &lt;code&gt;rxvt-unicode&lt;/code&gt; on my personal Arch machine. Using my preferred size for each font
      (pictured here), Termsyn is a little larger than Terminus. Furthermore, the
      &amp;ldquo;serif&amp;rdquo; qualities that I dislike in Tamsyn are not prevalent in Termsyn, due to
      its inheriting simple glyph shapes from Terminus.
    &lt;/p&gt;

  &lt;/li&gt;
&lt;/ol&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Quickly copy last Git commit hash</title>
    <link href="http://curtisfree.com/blog/2012/05/04/quickly_copy_last_git_commit_hash" />
    <updated>2012-05-04T21:34:00-04:00</updated>
    <content type="html">
      &lt;p&gt;A typical portion of my Git workflow involves the following:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Local &lt;code&gt;git commit&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;git push&lt;/code&gt; to upstream remote&lt;/li&gt;
  &lt;li&gt;Add a comment to an issue tracker that includes the new commit hash&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A simple shell (ZSH, BASH, or similar) function makes the last step a little bit easier:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;gitcp() { git log -1 --format=&quot;%H&quot; | xclip -in; }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After running &lt;code&gt;gitcp&lt;/code&gt;, the hash of the last commit is in X’s primary selection and can easily be
pasted into a comment box in the issue tracker.  &lt;/p&gt;

&lt;p&gt;Depending on your preferences, you can &lt;a href=&quot;http://linux.die.net/man/1/xclip&quot;&gt;instruct &lt;code&gt;xclip&lt;/code&gt;&lt;/a&gt; to copy into a different X
“selection” – or you can even use &lt;a href=&quot;http://www.nongnu.org/autocutsel/&quot;&gt;Autocutsel&lt;/a&gt; to sync your X selections.&lt;/p&gt;

&lt;p&gt;Not using X11? There are &lt;a href=&quot;http://stackoverflow.com/a/750466&quot;&gt;&lt;code&gt;xclip&lt;/code&gt; alternatives&lt;/a&gt; for OS X and Windows, so you can spin up
your own helper utility.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Adding the total line count to Vim's status line</title>
    <link href="http://curtisfree.com/blog/2012/04/22/adding_total_line_count_to_vim_statusline" />
    <updated>2012-04-22T08:23:00-04:00</updated>
    <content type="html">
      &lt;p&gt;By default, Vim displays some information about the current buffer/state on its command line (the
last line in the window):
&lt;img src=&quot;/imgs/laststatus_1.png&quot; alt=&quot;&quot; class=&quot;seamless&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As of late, I like asking Vim to display a second line of information at all times (&lt;code&gt;:set
laststatus=2&lt;/code&gt;). This leaves some information displayed on the command line but moves other info to
the “status line”:
&lt;img src=&quot;/imgs/laststatus_2.png&quot; alt=&quot;&quot; class=&quot;seamless&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As you can see in both screenshots, I have enabled Vim’s “ruler” (&lt;code&gt;:set ruler&lt;/code&gt;), which gives
line, column, and position (the last few fields in the commandline and the status line,
respectively). While this information can certainly be helpful, one might also wish to know a little
more detail about his/her progress through the buffer.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;'ruler'&lt;/code&gt; set, &lt;a href=&quot;https://vimhelp.appspot.com/options.txt.html#%27ruler%27&quot;&gt;Vim tries to do this&lt;/a&gt;; but sometimes, it can be useful to have the
total line count to compare with the current line number – not just a relative position.
Fortunately, Vim allows users to customize the contents of its status line.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;'statusline'&lt;/code&gt; option dictates what information is displayed on the status line. Since that
option is blank by default, one must dig through &lt;a href=&quot;https://vimhelp.appspot.com/options.txt.html#%27statusline%27&quot;&gt;the documentation&lt;/a&gt; to find the
true default. Here’s the relevant snippet:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Emulate standard status line with 'ruler' set
  :set statusline=%&amp;lt;%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;%l&lt;/code&gt; is the current line number. I like to place the total line count (&lt;code&gt;%L&lt;/code&gt;) just after that, as a
fraction:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:set statusline=%&amp;lt;%f\ %h%m%r%=%-14.(%l/%L,%c%V%)\ %P
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you expect to edit very large buffers, you might also wish to give Vim some additional space to
the right for many-digit line counts. Here, we give the line/column count group 20 characters
instead of the default 14:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:set statusline=%&amp;lt;%f\ %h%m%r%=%-20.(%l/%L,%c%V%)\ %P
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This gives a status line like the following:
&lt;img src=&quot;/imgs/laststatus_custom.png&quot; alt=&quot;&quot; class=&quot;seamless&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Of course, you can add &lt;code&gt;%L&lt;/code&gt; anywhere you like in your own status line. To make this setting “stick,”
add that line (minus the leading &lt;code&gt;:&lt;/code&gt;) to your &lt;code&gt;~/.vimrc&lt;/code&gt;.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Converting a GNOME Terminal colorscheme to X resources</title>
    <link href="http://curtisfree.com/blog/2012/03/24/convert_gnome_terminal_colors_x_resources" />
    <updated>2012-03-24T14:53:00-04:00</updated>
    <content type="html">
      &lt;p&gt;When I began using Linux regularly (nearly five years ago), I used both Ubuntu and Red Hat
Enterprise Linux (RHEL) – both with the GNOME desktop environment.&lt;/p&gt;

&lt;p&gt;Eventually, after moving to Arch, I developed a taste for lighter-weight applications, including my
terminal (I prefer &lt;a href=&quot;http://software.schmorp.de/pkg/rxvt-unicode.html&quot;&gt;&lt;code&gt;rxvt-unicode&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The default terminal in GNOME is, as you might have guessed, &lt;a href=&quot;http://library.gnome.org/users/gnome-terminal/stable/&quot;&gt;GNOME Terminal&lt;/a&gt;.
&lt;a href=&quot;http://climagic.org/bugreports/libvte-scrollback-written-to-disk.html&quot;&gt;Issues with VTE&lt;/a&gt; aside, GNOME Terminal is great; and I still use it often on some
machines. When I used Ubuntu, the default color scheme in GNOME Terminal was the “Linux console”
theme (which, I imagine, is designed to mimic the default colors of a &lt;a href=&quot;https://en.wikipedia.org/wiki/Virtual_terminal&quot;&gt;VT&lt;/a&gt; in Linux).&lt;/p&gt;

&lt;p&gt;When I began using a terminal configured via X resources
(think &lt;a href=&quot;/config/.Xdefaults&quot;&gt;&lt;code&gt;.Xdefaults&lt;/code&gt;&lt;/a&gt;), I sought to replicate this color scheme – which I still use on
my personal machine to this day. Fortunately, once you understand the basic relationship between
GNOME Terminal’s color preferences layout and the X resources color values, it’s easy to map any
scheme.&lt;/p&gt;

&lt;h4 id=&quot;colors-in-x-resources&quot;&gt;Colors in X resources&lt;/h4&gt;

&lt;p&gt;I won’t delve into the details of how X resources colors work in this post. For the purposes of a
basic tutorial, all you really need to know is that there are 16 “core” colors in X resources,
called &lt;code&gt;color0&lt;/code&gt;, &lt;code&gt;color1&lt;/code&gt;, etc., though &lt;code&gt;color15&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To set these colors for use by all applications that understand X resources, you simply need to add
lines like the following to &lt;code&gt;~/.Xdefaults&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;*color0:  #000000
*color8:  #555555
! ... (this is a comment)
*color7:  #AAAAAA
*color15: #FFFFFF
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(You’ll notice that those aren’t all in order. The reason isn’t really important here; if you’re
curious, search around for more information on colors in X resources/&lt;code&gt;.Xdefaults&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;After your colors are set, you can load them by issuing the following command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% xrdb -merge ~/.Xdefaults
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The modified settings will then take effect when the affected application is restarted.&lt;/p&gt;

&lt;p&gt;Chances are, your system is already configured to merge in your &lt;code&gt;.Xdefaults&lt;/code&gt; on login, so you only
really need to worry about that command when you want to see your changes during the current session
(which, I imagine, is most of the time); but note that some applications will understand changes the
next time they’re launched &lt;em&gt;without&lt;/em&gt; the need to &lt;code&gt;-merge&lt;/code&gt; yourself.&lt;/p&gt;

&lt;h4 id=&quot;get-your-colors-from-gnome-terminal&quot;&gt;Get your colors from GNOME Terminal&lt;/h4&gt;

&lt;p&gt;The key to using colors from GNOME Terminal with X resources is to understand which colors in the
preferences pane map to which color values.&lt;/p&gt;

&lt;p&gt;To get to the color options in GNOME Terminal, open the “Edit” menu and then select “Profiles…”;
select the profile whose colors you wish to copy, and then click the “Edit” button.&lt;/p&gt;

&lt;p&gt;Now, go to the “Colors” tab. At the bottom, you’ll see boxes that allow you to change each of the 16
colors available in GNOME Terminal:
&lt;img src=&quot;/imgs/gnome_terminal_colors.png&quot; alt=&quot;&quot; class=&quot;seamless&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The mapping is simple:&lt;/p&gt;
&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;code&gt;color0&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color1&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color2&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color3&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color4&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color5&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color6&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color7&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;code&gt;color8&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color9&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color10&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color11&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color12&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color13&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color14&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;color15&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;If you click a color in the grid, you’ll get the following window:
&lt;img src=&quot;/imgs/gnome_terminal_color_selection.png&quot; alt=&quot;&quot; class=&quot;seamless&quot; /&gt;
(Note that the window title gives the color number – the same as that in the above mapping table.)&lt;/p&gt;

&lt;p&gt;The value you need for your own &lt;code&gt;.Xdefaults&lt;/code&gt; is the one in the “Color name” box.&lt;/p&gt;

&lt;h4 id=&quot;putting-it-all-together&quot;&gt;Putting it all together&lt;/h4&gt;

&lt;p&gt;As you go through each of the colors in the GNOME Terminal preferences, you can add to and build
your color settings in your own &lt;code&gt;~/.Xdefaults&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;As I mentioned earlier, I use the GNOME Terminal “Linux console” colors on my personal (Arch)
machine. Here are the colors, taken from my own &lt;a href=&quot;/config/.Xdefaults&quot;&gt;&lt;code&gt;.Xdefaults&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;! colors
!! Taken from GNOME Terminal &quot;Linux console&quot; theme.
*color0:  #000000
*color8:  #555555
*color1:  #AA0000
*color9:  #FF5555
*color2:  #00AA00
*color10: #55FF55
*color3:  #AA5500
*color11: #FFFF55
*color4:  #0000AA
*color12: #5555FF
*color5:  #AA00AA
*color13: #FF55FF
*color6:  #00AAAA
*color14: #55FFFF
*color7:  #AAAAAA
*color15: #FFFFFF
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I also prefer a white background, with black “normal” text. These two “special” colors are set
as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;! bg/fg
*background: white
*foreground: black
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(Note that some colors can, in fact, be set by name rather than hex &lt;code&gt;#RRGGBB&lt;/code&gt; values.)&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Quickly changing between similar directories in BASH</title>
    <link href="http://curtisfree.com/blog/2012/02/08/quickly_changing_similar_directories_bash" />
    <updated>2012-02-08T20:03:00-05:00</updated>
    <content type="html">
      &lt;p&gt;I recently &lt;a href=&quot;http://www.acm.uiuc.edu/workshops/zsh/cd.html&quot;&gt;discovered&lt;/a&gt; a nifty trick in the &lt;code&gt;cd&lt;/code&gt; builtin provided by ZSH: the ability to
change from the current directory to another whose path is generated via simple (and, for better or
worse, non-global) search-and-replace:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% pwd
/top/left/bottom
% ls /top/*
/top/left:
bottom

/top/right:
bottom
% cd left right
/top/right/bottom
% pwd
/top/right/bottom
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Unfortunately, users of BASH don’t get this nicety; however, by adding a (somewhat) simple function
to your shell config (&lt;code&gt;~/.bashrc&lt;/code&gt; or perhaps &lt;code&gt;~/.bash_profile&lt;/code&gt;), you can emulate this behavior:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cd () { 
    if [ $# -eq 1 ]; then
        builtin cd ${1}
    elif [ $# -gt 2 ]; then
        echo -e &quot;usage: cd path&quot; &amp;gt;&amp;amp;2
        echo -e &quot;       cd to_replace replace_with&quot; &amp;gt;&amp;amp;2
        return 1
    else
        local new_pwd=$(echo ${PWD} | sed &quot;s/${1}/${2}/&quot;)
        builtin cd ${new_pwd} &amp;amp;&amp;amp; echo ${new_pwd}
    fi
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that this isn’t perfect. For example, it will not work with values of &lt;code&gt;to_replace&lt;/code&gt; or
&lt;code&gt;replace_with&lt;/code&gt; that contain forward slashes (or anything else that will mess with the &lt;code&gt;sed&lt;/code&gt;
command). There are certainly more involved methods that would avoid the limitations seen here.&lt;/p&gt;

&lt;h4 id=&quot;update-18-feb-2011&quot;&gt;&lt;em&gt;Update (18 Feb 2011):&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;http://josh-berry.blogspot.com&quot;&gt;Josh Berry&lt;/a&gt; points out that this can be done using &lt;a href=&quot;http://tldp.org/LDP/abs/html/string-manipulation.html&quot;&gt;BASH’s built-in string
manipulation&lt;/a&gt; in place of &lt;code&gt;sed&lt;/code&gt;. The relevant line in the above function can be
replaced with the following:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;local new_pwd=${PWD/${1}/${2}}
&lt;/code&gt;&lt;/pre&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Not all encrypted Google searches are equal</title>
    <link href="http://curtisfree.com/blog/2012/01/13/not_all_encrypted_google_searches_are_equal" />
    <updated>2012-01-13T10:33:00-05:00</updated>
    <content type="html">
      &lt;p&gt;Google offers two separate encrypted (i.e., via HTTPS) search pages:
&lt;a href=&quot;https://encrypted.google.com&quot;&gt;&lt;code&gt;https://encrypted.google.com&lt;/code&gt;&lt;/a&gt; (which has been established for some time) and
&lt;a href=&quot;https://www.google.com&quot;&gt;&lt;code&gt;https://www.google.com&lt;/code&gt;&lt;/a&gt; (a more recent development). The former has generally lagged
behind the standard Google search page in terms of features; &lt;code&gt;https://www.google.com&lt;/code&gt; looks more
like the regular Google search page.&lt;/p&gt;

&lt;p&gt;My personal motivation for preferring Google’s HTTPS variants is not to protect my search terms:
rather, I am concerned with the cookie information being passed between my browser and Google’s
servers. While I do not often (okay, &lt;em&gt;ever&lt;/em&gt;) use “open Wi-Fi,” failure to use an encrypted
connection means that there is increased potential for a session hijack (as highlighted by the
widely-publicized &lt;a href=&quot;http://codebutler.com/firesheep&quot;&gt;Firesheep&lt;/a&gt;).&lt;/p&gt;

&lt;div class=&quot;imgs&quot;&gt;
  &lt;a href=&quot;/imgs/g_https_encrypted.png&quot;&gt;&lt;img src=&quot;/imgs/g_https_encrypted.png&quot; width=&quot;250&quot; height=&quot;174&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/imgs/g_https_www.png&quot;&gt;&lt;img src=&quot;/imgs/g_https_www.png&quot; width=&quot;250&quot; height=&quot;174&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;Aside from differences in each version’s “frills,” there is an important security-relevant
difference between the two: the underlying search result links.&lt;/p&gt;

&lt;p&gt;Note that links in Google search results &lt;em&gt;look&lt;/em&gt; like they point directly at the result URL; however,
they actually point back to Google’s own servers, which redirect the browser to the actual result.
This means that Google can track clicks, lead to particular referers, and more.&lt;/p&gt;

&lt;p&gt;On &lt;code&gt;https://encrypted.google.com&lt;/code&gt;, these underlying links point back to
&lt;code&gt;https://encrypted.google.com&lt;/code&gt;; however, &lt;strong&gt;on &lt;code&gt;https://www.google.com&lt;/code&gt;, search result redirect links
not use HTTPS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, the first hit when searching for “Arch Linux” on &lt;code&gt;https://encrypted.google.com&lt;/code&gt; is
(line breaks added):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;https://encrypted.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=arch%20linux&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CDMQFjAA&amp;amp;url=htt
p%3A%2F%2Fwww.archlinux.org%2F&amp;amp;ei=7-AQT_D3JIGFtgeC05mVAg&amp;amp;usg=AFQjCNHBJwJZGGNQOe4ZlnbMOM676Q1H7g&amp;amp;
sig2=qeODYK6JsiPId9mR0kwyOw
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On &lt;code&gt;https://www.google.com&lt;/code&gt;, one has:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CDQQFjAA&amp;amp;url=http%3A%2F%2Fww
w.archlinux.org%2F&amp;amp;ei=GOEQT_SsOtGJtweYl-GLAg&amp;amp;usg=AFQjCNHBJwJZGGNQOe4ZlnbMOM676Q1H7g&amp;amp;sig2=ek7en0Z
ia2EtsYirM0xlsQ
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;While it is &lt;em&gt;unlikely&lt;/em&gt; that your session will be hijacked simply by following one of these
redirections, note that &lt;em&gt;any cookie information&lt;/em&gt; related to your authenticated session that is sent
across the Internet unencrypted carries some potential for misuse if it is intercepted.&lt;/p&gt;

&lt;p&gt;Users of the &lt;a href=&quot;https://www.eff.org/&quot;&gt;EFF&lt;/a&gt;’s &lt;a href=&quot;https://www.eff.org/https-everywhere&quot;&gt;HTTPS Everywhere&lt;/a&gt; Firefox extension are probably
already using &lt;code&gt;https://encrypted.google.com&lt;/code&gt;. If you’re using Chrome, you can manually add a new
search engine with a search string of:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;https://encrypted.google.com#q=%s
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you don’t already use the HTTPS-fortified Google search pages, give it a try.&lt;/p&gt;

&lt;h4 id=&quot;update-16-mar-2012&quot;&gt;&lt;em&gt;Update (16 Mar 2012):&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;The EFF has published &lt;a href=&quot;https://www.eff.org/deeplinks/2011/10/google-encrypts-more-searches&quot;&gt;a note&lt;/a&gt; pointing out another security-related discrepancy between
the two subdomains.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>I've shifted from Vimperator to Pentadactyl</title>
    <link href="http://curtisfree.com/blog/2011/12/31/vimperator_to_pentadactyl" />
    <updated>2011-12-31T17:51:00-05:00</updated>
    <content type="html">
      &lt;p&gt;I’ve been using &lt;a href=&quot;http://vimperator.org/vimperator&quot;&gt;Vimperator&lt;/a&gt; for years. I’m a huge fan of the &lt;a href=&quot;http://www.vim.org&quot;&gt;Vim&lt;/a&gt; text editor,
and Vimperator provides a Vim-like user experience in my favorite Web browser,
&lt;a href=&quot;https://www.mozilla.org/firefox&quot;&gt;Mozilla Firefox&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That said, Vimperator 3 was a departure from the experience I had come to know and enjoy.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The command line UI was revamped. In part, this led to the removal of what I consider a nice
security feature: color-coding (the status bar) to indicate the security in use on the current
page. Though one can use &lt;a href=&quot;https://code.google.com/p/vimperator-labs/issues/detail?id=542&quot;&gt;a custom script&lt;/a&gt; to re-implement this color-coding,
it causes noticable delay when changing tabs.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Certain lower-level aspects became less &lt;em&gt;Vim-like&lt;/em&gt;. For example, the &lt;code&gt;'guioptions'&lt;/code&gt; option (like
that in Vim) was replaced with &lt;code&gt;'gui'&lt;/code&gt; – which has different (and sometimes confusing) behavior.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Recently, a friend asked me about the browser enhancement I was using, and when researching it
herself, she discovered my new favorite Firefox extension:
&lt;a href=&quot;http://dactyl.sourceforge.net/pentadactyl/&quot;&gt;Pentadactyl&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;imgs&quot;&gt;
  &lt;a href=&quot;/imgs/pentadactyl.png&quot;&gt;&lt;img src=&quot;/imgs/pentadactyl.png&quot; width=&quot;250&quot; height=&quot;152&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;/imgs/pentadactyl_focus.png&quot;&gt;&lt;img src=&quot;/imgs/pentadactyl_focus.png&quot; width=&quot;250&quot; height=&quot;152&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;Pentadactyl began as a fork of pre-3.0 Vimperator when two of the latter’s primary developers left
the project. While Vimperator development has focused on “usability,” “simplicity”, “stability”,
and “design” (as described in &lt;a href=&quot;https://code.google.com/p/vimperator-labs/wiki/VimperatorVsPentadactyl&quot;&gt;in the Vimperator wiki&lt;/a&gt;), Pentadactyl has maintained
(and pushed toward) a truer Vim experience that can fulfill a hacker’s dream.&lt;/p&gt;

&lt;p&gt;Importantly, both of the &lt;em&gt;specific&lt;/em&gt; points mentioned above are nonissues with Pentadactyl:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;The status bar security color-coding is functional. Like Vimperator, Pentadactyl now (by default)
shows only a single line at the bottom of the window. Whereas Vimperator’s “single line” is a
dual-purpose status and command line, Pentadactyl shows only the status line and reveals the
command line only when necessary.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Pentadactyl still uses &lt;code&gt;'guioptions'&lt;/code&gt;. That said, some options diverge from what one might be
accustomed to with Vim. Notably, search-related options use the term &lt;code&gt;find&lt;/code&gt; instead of &lt;code&gt;search&lt;/code&gt;
(e.g., Vim’s &lt;code&gt;'hlsearch'&lt;/code&gt; vs. Pentadactyl’s &lt;code&gt;'hlfind'&lt;/code&gt;); and Vim’s multiple case-related options
(&lt;code&gt;'ignorecase'&lt;/code&gt; and &lt;code&gt;'smartcase'&lt;/code&gt;) are unified into a single option (&lt;code&gt;'findcase'&lt;/code&gt;).&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you love Vim and have been using Vimperator, give Pentadactyl a shot (you’ll need to update your
&lt;a href=&quot;/config/.vimperatorrc&quot;&gt;&lt;code&gt;.vimperatorrc&lt;/code&gt;&lt;/a&gt; to a compatible &lt;a href=&quot;/config/.pentadactylrc&quot;&gt;&lt;code&gt;.pentadactylrc&lt;/code&gt;&lt;/a&gt;).  If you’re new
to both, try each in turn and see which you prefer!&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Site and blog now powered by Jekyll + PHP + Apache</title>
    <link href="http://curtisfree.com/blog/2011/12/29/site_and_blog_now_powered_jekyll_php_apache" />
    <updated>2011-12-29T17:29:00-05:00</updated>
    <content type="html">
      &lt;h4 id=&quot;out-with-the-old&quot;&gt;Out with the old!&lt;/h4&gt;

&lt;p&gt;Previously, my site was powered by &lt;em&gt;CF-CMS&lt;/em&gt; (my own PHP-based content management system), and my
blog was on &lt;a href=&quot;https://www.blogger.com&quot;&gt;Blogger&lt;/a&gt;. Though both were sufficient, managing the appearance of my blog is
much easier when writing code from scratch than when hacking on a Blogger template. Furthermore,
using Jekyll is a type of learning experience.&lt;/p&gt;

&lt;h4 id=&quot;in-with-the-new&quot;&gt;In with the new!&lt;/h4&gt;

&lt;p&gt;My site and blog are now powered by &lt;a href=&quot;http://jekyllrb.com&quot;&gt;Jekyll&lt;/a&gt;. I’m quite particular regarding some aspects of
my site—particularly, the URLs. Therefore, I’m using a small PHP “gatekeeper” that allows me to
manage URLs exactly. Ultimately, content is stored as static HTML; but it is “fed” to into the
response by a PHP script. While this does create some overhead, my site certainly isn’t popular
enough (at present, anyway) for that to matter.&lt;/p&gt;

&lt;p&gt;Other functionality achieved by &lt;em&gt;CF-CMS&lt;/em&gt; using PHP has now been pushed to Apache via &lt;code&gt;.htaccess&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The long-term success of Jekyll is yet to be seen, as it hasn’t been around as long as more
popular (and user-friendly) solutions like &lt;a href=&quot;https://wordpress.org&quot;&gt;WordPress&lt;/a&gt;. The fact that
&lt;a href=&quot;http://pages.github.com&quot;&gt;GitHub Pages&lt;/a&gt; supports Jekyll is certain to lend it a push among geeks, but only time
will tell how it will fare.&lt;/p&gt;

&lt;h4 id=&quot;what-this-means&quot;&gt;What this means…&lt;/h4&gt;

&lt;p&gt;By choice, my blog can now be found at &lt;a href=&quot;/blog&quot;&gt;&lt;code&gt;curtisfree.com/blog&lt;/code&gt;&lt;/a&gt; (as opposed to
&lt;code&gt;blog.curtisfree.com&lt;/code&gt;. Further wreaking havoc with existing “permalinks,” I’ve changed individual
post paths, too.&lt;/p&gt;

&lt;p&gt;The Atom feed for blog posts can now be found at &lt;a href=&quot;/blog/feed&quot;&gt;&lt;code&gt;curtisfree.com/blog/feed&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A significant side effect of leaving Blogger for Jekyll is that I no longer have native support for 
comments. Many (most?) bloggers using Jekyll make use of &lt;a href=&quot;https://disqus.com&quot;&gt;DISQUS&lt;/a&gt; to add third-party support
for comments, but I’ve chosen to have &lt;em&gt;no comments&lt;/em&gt; for now. The question-mark link at the end of
each post is a stand-in, giving a link to email me directly with any comments and/or questions.&lt;/p&gt;

&lt;h4 id=&quot;so&quot;&gt;So?&lt;/h4&gt;

&lt;p&gt;I’m happier with the new solution and – hopefully – won’t be changing it anytime soon.&lt;/p&gt;

&lt;h4 id=&quot;update-29-dec-2011&quot;&gt;&lt;em&gt;Update (29 Dec 2011):&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;The code for my site (and blog) is now &lt;a href=&quot;https://github.com/cfree3/CurtisFree.com&quot;&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Using Amazon.com's Universal Wishlist with Vimperator</title>
    <link href="http://curtisfree.com/blog/2011/08/06/using_amazon_universal_wishlist_with_vimperator" />
    <updated>2011-08-06T16:54:00-04:00</updated>
    <content type="html">
      &lt;p&gt;You can also use Vimperator to add items to your Amazon.com wish list. With
the following code, the command &lt;code&gt;:amzwishlist&lt;/code&gt; will do the trick:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;&quot; Amazon Universal Wishlist
&quot;&quot;&quot; JS derived from http://www.amazon.com/wishlist/get-button (also see Delicious credits above).
&quot;&quot;&quot;&quot; NOTE: If not already logged into Amazon.com, this will not always work ('&amp;amp;' isn't handled
&quot;&quot;&quot;&quot;       by Amazon when passing through login).
command! amzwishlist js add_to_amazon_wishlist();
:js &amp;lt;&amp;lt;EOJS
  add_to_amazon_wishlist = function() {
    var amazon_wishlist_url = 'http://www.amazon.com/wishlist/add'
                            + '?u=' + encodeURIComponent(window.getBrowser().currentURI.spec)
                            + '&amp;amp;t=' + encodeURIComponent(window.getBrowser().contentDocument.title);
    window.open(amazon_wishlist_url, 'amzwishlist', 'width=900,height=553');
  }
EOJS
&lt;/code&gt;&lt;/pre&gt;

    </content>

  </entry>
  
  <entry>

    
    
    <title>Easy Delicious bookmarking with Vimperator</title>
    <link href="http://curtisfree.com/blog/2011/08/06/easy_delicious_bookmarking_with_vimperator" />
    <updated>2011-08-06T16:52:00-04:00</updated>
    <content type="html">
      &lt;p&gt;If you use &lt;a href=&quot;http://vimperator.org/trac/wiki/Vimperator&quot;&gt;Vimperator&lt;/a&gt;, add the following to your &lt;code&gt;~/.vimperatorrc&lt;/code&gt; to enable the
addition of a &lt;a href=&quot;http://delicious.com/&quot;&gt;Delicious&lt;/a&gt; bookmark for the current page simply by pressing &lt;code&gt;D&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&quot;&quot; Bookmark on Delicious
&quot;&quot;&quot; JS derived from http://delicious.com/help/bookmarklets.
&quot;&quot;&quot; For reference, see https://developer.mozilla.org/en/XUL/browser.
map D :js add_to_delicious()&amp;lt;CR&amp;gt;
:js &amp;lt;&amp;lt;EOJS
  add_to_delicious = function() {
    var delicious_url = 'http://delicious.com/save'
                      + '?url=' + encodeURIComponent(window.getBrowser().currentURI.spec)
                      + '&amp;amp;title=' + encodeURIComponent(window.getBrowser().contentTitle)
                      + '&amp;amp;v=5&amp;amp;noui=1&amp;amp;jump=doclose'
                      + '&amp;amp;share=no'; // default share setting
    window.open(delicious_url, 'deliciousuiv5', 'width=550,height=550');
  }
EOJS
&lt;/code&gt;&lt;/pre&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Keeping your home directory clean with Git</title>
    <link href="http://curtisfree.com/blog/2011/08/06/keeping_your_home_directory_clean_with_git" />
    <updated>2011-08-06T16:50:00-04:00</updated>
    <content type="html">
      &lt;p&gt;I recently decided to keep my important and public dotfiles in &lt;a href=&quot;/config&quot;&gt;a repository&lt;/a&gt; on
&lt;a href=&quot;https://github.com/&quot;&gt;Github&lt;/a&gt;. In doing so, I comitted &lt;em&gt;most&lt;/em&gt; of the simple configuration files that I &lt;strong&gt;want&lt;/strong&gt;
to have present in my home directory.&lt;/p&gt;

&lt;p&gt;Of course, though, over time I tend to collect numerous &lt;em&gt;unwanted&lt;/em&gt; files in my home directory
(e.g., &lt;code&gt;.esd_auth&lt;/code&gt;, &lt;code&gt;.zcompdump&lt;/code&gt;). Some time ago, I developed a series of scripts to clean up my
home directory, and I typically run these scripts prior to shutting down my computer; however,
I have found that it is easy to use &lt;a href=&quot;http://git-scm.com/&quot;&gt;Git&lt;/a&gt; to help keep my home directory constantly tidy.&lt;/p&gt;

&lt;p&gt;After committing what one wants to a Git repository, a check of &lt;code&gt;git status&lt;/code&gt; will reveal that
&lt;em&gt;everything else&lt;/em&gt; is not currently under version control. That’s where excludes (or “ignores”)
come in handy. Assuming that the root of your repository is in your home directory,
&lt;code&gt;~/.git/info/exclude&lt;/code&gt; can be used to tell Git which files you do not want under its control.&lt;/p&gt;

&lt;p&gt;Here, add all files/directories that you &lt;em&gt;want&lt;/em&gt; in your home directory but do not wish to commit.
Ensure that you do not list any files you do &lt;strong&gt;not&lt;/strong&gt; want at all (files like the aforementioned
&lt;code&gt;.zcompdump&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Now, barring any changes you have made to files that &lt;em&gt;are&lt;/em&gt; in your repo, &lt;code&gt;git status&lt;/code&gt; can be used
to reveal a quick list of any unwanted files that have accumulated:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cfree3@CF-PC:~% git st # 'st' is an alias I have set for 'status'
# On branch master
# Untracked files:
#   (use &quot;git add &amp;lt;file&amp;gt;...&quot; to include in what will be committed)
#
#       .esd_auth
#       .gconfd/
#       .macromedia/
#       .viminfo
#       .vimperator/
#       .zcompdump
#       .zsh_history
nothing added to commit but untracked files present (use &quot;git add&quot; to track)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One caveat: Git will &lt;em&gt;not&lt;/em&gt; “alert” you to unwanted directories (including nested directories) if
they contain no actual files (see why &lt;a href=&quot;https://www.google.com/search?q=git+empty+directories&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cfree3@CF-PC:~% grep &quot;.adobe&quot; .git/info/exclude
cfree3@CF-PC:~% tree .adobe
.adobe
`-- Flash_Player
    `-- AssetCache
        `-- 5885UGDY

3 directories, 0 files
cfree3@CF-PC:~% git st
# On branch master
nothing to commit (working directory clean)
&lt;/code&gt;&lt;/pre&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Quickly changing voicemail providers on Android</title>
    <link href="http://curtisfree.com/blog/2011/08/06/quickly_changing_voicemail_providers_on_android" />
    <updated>2011-08-06T16:45:00-04:00</updated>
    <content type="html">
      &lt;p&gt;&lt;img src=&quot;/imgs/vmswitch.png&quot; alt=&quot;&quot; class=&quot;left&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I have a Motorola Droid. Rather than using Verizon’s own voicemail service, I choose to manage
my voicemail via &lt;a href=&quot;https://voice.google.com/&quot;&gt;Google Voice&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One day, I left a voicemail in someone else’s Verizon mailbox. After listening to my message,
my friend chose to use Verizon’s “reply” feature (basically, the user replies by directly leaving
a voicemail in the caller’s own Verizon mailbox). Until this point, I had not even set up my Verizon
voicemail, and so I never received the message.&lt;/p&gt;

&lt;p&gt;I have since set up my Verizon mailbox; however, I continue to use Google’s services over Verizon’s
own. The problem: &lt;em&gt;what do I do if someone sends me a voicemail reply in the future?&lt;/em&gt; To reconcile
my desire to use one voicemail provider and my need to have access to another, I need a quick way
to switch between mailboxes.&lt;/p&gt;

&lt;p&gt;My solution: add direct-dial shortcuts to make the voicemail switch.&lt;/p&gt;

&lt;p&gt;First, I added two new contacts: &lt;em&gt;VM VZW&lt;/em&gt; (Verizon voicemail) and &lt;em&gt;VZW GV&lt;/em&gt; (Google Voice). Within
each contact, I have a single number (of type &lt;em&gt;VSC&lt;/em&gt;, for &lt;a href=&quot;https://en.wikipedia.org/wiki/Vertical_service_code&quot;&gt;Vertical Service Code&lt;/a&gt;). These
numbers are provided by Google when one chooses to use or stop using the Google voicemail service:
for &lt;em&gt;VM VZW&lt;/em&gt;: &lt;code&gt;*71&amp;lt;google_voice_number&amp;gt;&lt;/code&gt;; for &lt;em&gt;VM GV&lt;/em&gt;: &lt;code&gt;*73&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, I added “direct dial” shortcuts for each number to one of my phone’s home screens (like
those in the image above). Now, with one these shortcuts, I can easily switch from one service
to the other. I can then check my voicemail (&lt;code&gt;*78&lt;/code&gt; on Verizon), and I will be sent whichever
service I am using.&lt;/p&gt;

&lt;p&gt;With only slight modifications, this solution can be adapted to suit your own needs (or your own wireless carrier).&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Using the TrueCrypt CLI</title>
    <link href="http://curtisfree.com/blog/2011/07/04/using_truecrypt_cli" />
    <updated>2011-07-04T16:02:00-04:00</updated>
    <content type="html">
      &lt;p&gt;&lt;a href=&quot;http://www.truecrypt.org/&quot;&gt;TrueCrypt&lt;/a&gt; is a great utility for hiding sensitive data – whether in an encrypted disk
image or on an entire encrypted partition.&lt;/p&gt;

&lt;p&gt;I encourage you to check out TrueCrypt, but that is not the point of this post.&lt;/p&gt;

&lt;p&gt;Most TrueCrypt users are likely accustomed to its GUI. In fact, I very much like it. That said,
some users do not realize that there is also a command-line interface (CLI) to TrueCrypt.&lt;/p&gt;

&lt;p&gt;The key to using TrueCrypt from a terminal is the &lt;code&gt;-t&lt;/code&gt; flag – which signals to the utility that
you wish to use its &lt;code&gt;t&lt;/code&gt;extual interface.&lt;/p&gt;

&lt;p&gt;After an encrypted volume has been created (a task that can also be accomplished via terminal),
the two most common tasks will be &lt;em&gt;mounting&lt;/em&gt; and &lt;em&gt;unmounting&lt;/em&gt; the volume.&lt;/p&gt;

&lt;p&gt;Mounting is simple and is the “default” option (requiring no special flags/commands). Simply tell
TrueCrypt the location of the encrypted volume (disk image or device) and the mountpoint:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% truecrypt -t /dev/sdc /media/my_volume
Enter password for /dev/sdc:
Enter keyfile [none]:
Protect hidden volume (if any)? (y=Yes/n=No) [No]:
Enter your user password or administrator password:
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that this makes it easy to choose an &lt;em&gt;arbitrary mountpoint&lt;/em&gt; for the volume (rather than the
default, which for me is &lt;code&gt;/media/truecrypt1&lt;/code&gt; for the first mounted volume). You can use a more
complex command to avoid some of the prompts seen in that example.&lt;/p&gt;

&lt;p&gt;Dismounting is also a simple task:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;% truecrypt -t -d /media/my_volume
Enter your user password or administrator password:
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;For a full description of how to use TrueCrypt’s CLI, check out the built-in help (N.B., there’s
no man page):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;% truecrypt --help # Opens GUI containing help info and prints to terminal.&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;% truecrypt -t --help # Prints to terminal only.&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;% truecrypt -t --help | less # Nicer. :-)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you begin using the CLI interface regularly, then do yourself a little favor and add an alias
to your shell config: &lt;code&gt;alias truecrypt='truecrypt -t'&lt;/code&gt;.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>A look at paging in the Web-based Android Market</title>
    <link href="http://curtisfree.com/blog/2011/05/21/look_at_paging_in_web_based_android_market" />
    <updated>2011-05-21T13:39:00-04:00</updated>
    <content type="html">
      &lt;p&gt;If you have an Android phone and haven’t visited the Web-based &lt;a href=&quot;https://market.android.com/&quot;&gt;Android Market&lt;/a&gt;, you
should check it out. Just this morning, I was glancing over pages of the &lt;a href=&quot;https://market.android.com/details?id=apps_topselling_free&quot;&gt;top free apps&lt;/a&gt;
and noticed something about the pager (shown below the app results).&lt;/p&gt;

&lt;p&gt;The formula is simple. If on a page &lt;code&gt;x, x &amp;lt;= 5&lt;/code&gt;, the paging menu allows selection of the first &lt;code&gt;x * 2&lt;/code&gt; pages:
&lt;img src=&quot;/imgs/am_pg_1.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/am_pg_2.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/am_pg_3.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/am_pg_4.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/am_pg_5.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;If on a page &lt;code&gt;5 &amp;lt;= x &amp;lt; 10&lt;/code&gt;, the user is always presented with a selection of the first 10 pages:
&lt;img src=&quot;/imgs/am_pg_9.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Then, for any page &lt;code&gt;x &amp;gt;= 10&lt;/code&gt;, the user is presented with a list of pages from &lt;code&gt;x -5&lt;/code&gt; through
&lt;code&gt;x + 5&lt;/code&gt; (inclusive – total of 11 pages):
&lt;img src=&quot;/imgs/am_pg_10.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/am_pg_12.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a departure from the usual: most sites with such paging menus offer the user a constant
number of pages for selection (surrounding the current page).&lt;/p&gt;

&lt;p&gt;But what motivated Google’s design? There are multiple possibilities:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;User experience.&lt;/em&gt;
Simple: Why show the user so many pages in the menu? The further a user delves into the pages, the
further he/she will likely go, so show more pages as the user goes further into the results.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;Querying.&lt;/em&gt;
Perhaps the query used on the backend examines only enough data to know that there are a certain
number of pages. Most users only visit the earliest pages, so why even consider the later results
to determine how many pages there are?&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Interesting design, Google.&lt;/p&gt;

&lt;h4 id=&quot;update-update-03-jul-2011&quot;&gt;Update: &lt;em&gt;Update (03 Jul 2011):&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;It appears that the Market is no longer using the page selector described in this post. Instead,
the selector now offers the first 10 pages while on page &lt;code&gt;x &amp;lt; 10&lt;/code&gt;, and pages &lt;code&gt;x - 5&lt;/code&gt; through &lt;code&gt;x + 5&lt;/code&gt;
(inclusive; 11 total) thereafter until there are too few pages left to do so, at which point the
last 11 pages are shown.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>Building a simple Twitter widget using RSS...</title>
    <link href="http://curtisfree.com/blog/2011/04/09/building_simple_twitter_widget_using_rss" />
    <updated>2011-04-09T12:53:00-04:00</updated>
    <content type="html">
      &lt;p&gt;Sometimes, &lt;a href=&quot;https://twitter.com/about/resources/widgets&quot;&gt;Twitter’s “stock” widgets&lt;/a&gt; aren’t quite what you want.&lt;/p&gt;

&lt;p&gt;Sure, they look pretty nice; I’m even using one on this blog. But if you want to integrate Twitter
info into an existing website, they don’t cut it. What then?&lt;/p&gt;

&lt;p&gt;There’s the &lt;a href=&quot;https://apiwiki.twitter.com/&quot;&gt;Twitter API&lt;/a&gt;. If you want to build any type of complex Twitter app/widget,
then that might be the right solution for you, but if you want &lt;em&gt;only to display simple,
publicly-available tweets&lt;/em&gt;, then you can build your own widget using publicly-available Twitter RSS
feeds.&lt;/p&gt;

&lt;h4 id=&quot;check-out-your-own-feed&quot;&gt;Check out your own feed!&lt;/h4&gt;

&lt;p&gt;To see the feed for your own tweets, visit your Twitter profile using the old
Twitter interface (I’m not sure where to find the RSS URL in the new UI). Below the
icons of your followers, you should see a link to an RSS feed of your tweets:
&lt;img src=&quot;/imgs/twitter_rss.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Copy that URL: you’ll need it later.&lt;/p&gt;

&lt;h4 id=&quot;get-coding&quot;&gt;Get coding!&lt;/h4&gt;

&lt;p&gt;I’m going to cover building a widget using PHP. If you prefer another language, I’m sure you can
figure it out.&lt;/p&gt;

&lt;p&gt;The first step is to determine &lt;em&gt;how&lt;/em&gt; you will fetch and parse the RSS feed. I use
&lt;a href=&quot;http://magpierss.sourceforge.net/&quot;&gt;Magpie RSS&lt;/a&gt; for this task. There are newer libraries for PHP available, but Magpie is
simple and &lt;em&gt;works&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Let’s take a look at my own widget (see &lt;a href=&quot;/&quot;&gt;my homepage&lt;/a&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;?php

    require('tp/magpierss/rss_fetch.inc'); // using Magpie RSS

    // get the latest tweet via RSS
    $url = 'http://twitter.com/statuses/user_timeline/222659411.rss';
    $latest_tweet = fetch_rss($url)-&amp;gt;items[0]['title'];

    // we'll replace some patterns in the tweet
    $patterns = array(); $replacements = array();

    $patterns[] = '/curtisafree: /'; // remove Twitter username
    $replacements[] = '';

    $patterns[] = '/(https?:\/\/[^ ]+)/'; // make URLs into links
    $replacements[] = '&amp;lt;a href=&quot;\1&quot;&amp;gt;\1&amp;lt;/a&amp;gt;';

    $patterns[] = '/@([a-zA-Z0-9_]+)/'; // turn user references into links
    $replacements[] = '&amp;lt;a href=&quot;https://twitter.com/\1&quot;&amp;gt;@\1&amp;lt;/a&amp;gt;';

    echo preg_replace($patterns, $replacements, $latest_tweet);

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The first task is to import the Magpie code. My path (&lt;code&gt;tp/magpierss/rss_fetch.inc&lt;/code&gt;) will only be
valid if that is where you have placed the code within your website hierarchy. Adjust the path as
appropriate.&lt;/p&gt;

&lt;p&gt;Then, we actually fetch the information from Twitter. (Note that Magpie RSS uses caching, so the
load you’ll be placing on the Twitter servers isn’t too bad; but if you expect very heavy traffic,
you might consider using the official API instead.)&lt;/p&gt;

&lt;p&gt;Magpie makes this simple. Using the URL you found earlier, we simply fetch the first tweet in the
feed. Within the RSS entry, both the title and body give the actual tweet text – so either should
do the trick. I chose to pull out the title.&lt;/p&gt;

&lt;p&gt;You could stop here, if you wanted. You have the tweet text and can display it as you wish. I
continue with some embellishments, though.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$patterns&lt;/code&gt; gives patterns to find within the tweet, and &lt;code&gt;$replacements&lt;/code&gt; gives the corresponding
replacement patterns (yep, PHP’s &lt;a href=&quot;http://php.net/preg_replace&quot;&gt;&lt;code&gt;preg_replace&lt;/code&gt;&lt;/a&gt; can handle sets of patterns and
their corresponding replacements!).&lt;/p&gt;

&lt;p&gt;First, I remove my own Twitter username from the beginning of the tweet (there’s no need to show
it).&lt;/p&gt;

&lt;p&gt;Now, there are two types of links within a tweet that I’d like to represent as actual links: Twitter
usernames (&lt;code&gt;@username&lt;/code&gt;) and actual URLs. This can be accomplished using the patterns/replacements on
lines 10-13.&lt;/p&gt;

&lt;p&gt;You might have noticed in the newer Twitter UI that some tweets contain links without the protocol
(&lt;code&gt;http&lt;/code&gt;/&lt;code&gt;https&lt;/code&gt;). The RSS feed, though, is more like the old Twitter UI. You’ll see full URLs. (For
example, I &lt;a href=&quot;https://twitter.com/curtisafree/status/47485007014543360&quot;&gt;tweeted&lt;/a&gt; about &lt;a href=&quot;http://goo.gl/&quot;&gt;goo.gl&lt;/a&gt; recently, and you can see a difference in
UIs (old and then new):
&lt;img src=&quot;/imgs/tweet_old.png&quot; alt=&quot;&quot; /&gt;
&lt;img src=&quot;/imgs/tweet_new.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Via RSS, you’ll see the former – so the regex I provided above should be sufficient.&lt;/p&gt;

&lt;p&gt;And there you have it: a simple Twitter widget that you can place anywhere on your website.&lt;/p&gt;


    </content>

  </entry>
  
  <entry>

    
    
    <title>A tip to start my blog off right...</title>
    <link href="http://curtisfree.com/blog/2011/04/04/tip_to_start_my_blog_off_right" />
    <updated>2011-04-04T23:35:00-04:00</updated>
    <content type="html">
      &lt;p&gt;Did you know that you can include (at least some) HTML in your Blogger title?&lt;/p&gt;

&lt;p&gt;Simply enter the HTML along with your normal text.&lt;/p&gt;

&lt;p&gt;For example, my title is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;a href=&quot;http://curtisfree.com&quot;&amp;gt;CurtisFree.com&amp;lt;/a&amp;gt; &amp;lt;a href=&quot;http://blog.curtisfree.com&quot;&amp;gt;Blog&amp;lt;/a&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note, however, that if all of the printable characters in your title are links, you’ll have to
use the links &lt;em&gt;below&lt;/em&gt; it in the blog list to go to its settings (as the usually-clickable title
will have your links).&lt;/p&gt;

&lt;h4 id=&quot;update-24-sep-2011&quot;&gt;&lt;em&gt;Update (24 Sep 2011):&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;While this tip still works:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;I don’t use &lt;a href=&quot;http://blogger.com&quot;&gt;Blogger&lt;/a&gt; anymore; I use &lt;a href=&quot;http://jekyllrb.com&quot;&gt;jekyll&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;The mention of links in the Blogger UI is probably no longer accurate.&lt;/li&gt;
&lt;/ol&gt;


    </content>

  </entry>
  
</feed>


