<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>byronc bits</title>
    <link>http://byron.theclarkfamily.name/blog</link>
    <description>breaking old technology, one bit at a time</description>
    <pubDate>Fri, 04 Jun 2010 03:12:24 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>udiskie</title>
      <link>http://byron.theclarkfamily.name/blog/2010/06/03/udiskie</link>
      <pubDate>Thu, 03 Jun 2010 20:55:02 MDT</pubDate>
      <category><![CDATA[archlinux]]></category>
      <category><![CDATA[tools]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2010/06/03/udiskie</guid>
      <description>udiskie</description>
      <content:encoded><![CDATA[<p>With the <a href="http://fedoraproject.org/wiki/Features/HalRemoval">deprecation</a>
   <a href="http://wiki.debian.org/HALRemoval">of</a>
   <a href="https://wiki.ubuntu.com/Halsectomy">HAL</a> proceeding at full speed it's time to
   find a new solution for automounting disks on my Linux box.  I've been happily
   using <a href="http://www.nongnu.org/halevt/">halevt</a>, which does a lot more than disk
   mounting, but won't be of much use once HAL really goes away.
   <a href="http://www.freedesktop.org/wiki/Software/udisks">udisks</a> is the replacement
   that the major desktops are moving to, so I decided to write a simple
   automounting daemon for those of us not using a major desktop:
   <a href="http://www.bitbucket.org/byronclark/udiskie">udiskie</a>.  It's a simple udisks
   client that just takes care of mounting removable media right now.  I run it by
   adding <code>udiskie &amp;</code> to <code>~/.xinitrc</code>.  When I'm done using a removable disk,
   <code>udiskie-umount</code> will take care of the unmount.  I probably can't stress enough
   how simplistic and undocumented this approach is, but it works for me.
</p>
<p>And, of course, for the Archlinux users, it's already packaged in the AUR:
   <a href="http://aur.archlinux.org/packages.php?ID=37279">udiskie</a>
</p>]]></content:encoded>
    </item>
    <item>
      <title>pm-utils and Locked Screens</title>
      <link>http://byron.theclarkfamily.name/blog/2010/04/06/pm-utils-and-locked-screens</link>
      <pubDate>Tue, 06 Apr 2010 05:54:54 MDT</pubDate>
      <category><![CDATA[tips]]></category>
      <category><![CDATA[archlinux]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2010/04/06/pm-utils-and-locked-screens</guid>
      <description>pm-utils and Locked Screens</description>
      <content:encoded><![CDATA[<p><a href="http://pm-utils.freedesktop.org/wiki/">pm-utils</a> seems to be the clear winner
   to userspace suspend and hibernate setup.  It's a great back, but, for those of
   us who don't run a desktop environment with a power manager, there's one thing
   missing: screen locking.  I'd like the screen to be locked when my computer
   resumes from either suspend or hibernate, and I don't want to run
   gnome-power-manager to get that functionality.  So,
   <a href="/dump/00lock-screen">00lock-screen</a> to the rescue.  Just drop that file in
   <code>/etc/pm/sleep.d</code> and, as long as you have <code>xscreensaver</code>, <code>gnome-screensaver</code>,
   <code>i3lock</code>, or <code>xlock</code> setup, the screen will lock as your computer suspends or
   hibernates.
</p>
<p>For the Archlinux users, it's already packaged in the AUR:
   <a href="http://aur.archlinux.org/packages.php?ID=36219">pm-utils-screen-lock</a>
</p>]]></content:encoded>
    </item>
    <item>
      <title>OpenWRT on the D-Link DIR-615</title>
      <link>http://byron.theclarkfamily.name/blog/2010/03/10/openwrt-on-the-d-link-dir-615</link>
      <pubDate>Wed, 10 Mar 2010 06:41:01 MST</pubDate>
      <category><![CDATA[tips]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2010/03/10/openwrt-on-the-d-link-dir-615</guid>
      <description>OpenWRT on the D-Link DIR-615</description>
      <content:encoded><![CDATA[<p>Last night, I finally got around to installing the <a href="https://forum.openwrt.org/viewtopic.php?id=23829">OpenWRT 10.03
Beta</a> on my D-Link
   DIR-615.  The short version: it works and works well.  There were only
   two surprises I ran into.
</p>
<p>The first surprise is that the wireless drivers are not included in
   the install image.  Running <code>opkg update; opkg install kmod-ath9k</code>
   takes care of that.  The drivers are left out by design at least on
   <a href="https://dev.openwrt.org/ticket/6835">this router</a> and the
   <a href="https://dev.openwrt.org/ticket/6833">WRT160NL</a>.  Bonus points to
   OpenWRT for allowing me to file a bug without creating an account on
   their bug tracker.
</p>
<p>The second surprise is that the dynamic dns client doesn't know about
   <a href="http://www.dnsomatic.com">DNS-O-Matic</a>.  I installed the
   <code>ddns-scripts</code> package and used the following config to get it
   working:
</p>
<pre>
config 'service' 'myddns'
	option 'ip_source' 'network'
	option 'ip_network' 'wan'
	option 'check_unit' 'minutes'
	option 'enabled' '1'
	option 'domain' 'all.dnsomatic.com'
	option 'username' 'username'
	option 'password' 'password'
	option 'update_url' 'http://[USERNAME]:[PASSWORD]@updates.dnsomatic.com/nic/update?hostname=[DOMAIN]&myip=[IP]'
	option 'check_interval' '5'
	option 'force_interval' '480'
	option 'force_unit' 'hours'
</pre>]]></content:encoded>
    </item>
    <item>
      <title>gdb and pthread</title>
      <link>http://byron.theclarkfamily.name/blog/2010/02/19/gdb-and-pthread</link>
      <pubDate>Fri, 19 Feb 2010 21:33:22 MST</pubDate>
      <category><![CDATA[tips]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2010/02/19/gdb-and-pthread</guid>
      <description>gdb and pthread</description>
      <content:encoded><![CDATA[<p>Error message translation time.  Here's an error gdb gave me today:
</p>
<pre>
[Thread debugging using libthread_db enabled]             
Cannot find new threads: generic error
</pre>

<p>Translation: Programs that use pthread functions should really be linked with
   the <code>-lpthread</code> option.
</p>]]></content:encoded>
    </item>
    <item>
      <title>Scripting wireshark with lua</title>
      <link>http://byron.theclarkfamily.name/blog/2009/12/09/scripting-wireshark-with-lua</link>
      <pubDate>Wed, 09 Dec 2009 06:44:23 MST</pubDate>
      <category><![CDATA[tips]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/12/09/scripting-wireshark-with-lua</guid>
      <description>Scripting wireshark with lua</description>
      <content:encoded><![CDATA[
<p>While attempting to wrap some <a
    href="http://www.wireshark.org/">wireshark</a> processing with a bash
script, I discovered that I didn't need to write complex bash code at all,
because wireshark has a built-in scripting language.  Even better, it's a
common scripting language: <a href="http://www.lua.org/">lua</a>.  It looks
like Debian and its derivatives ship wireshark with lua support, but for
everything else, you'll have to rebuild the package to enable it. There's a
great page of <a href="http://wiki.wireshark.org/Lua/Examples">examples</a> and
the <a
    href="http://www.wireshark.org/docs/wsug_html_chunked/wsluarm.html">api</a>
is really simple.  And for those cases where you don't want to use the
wireshark GUI, lua scripts work just fine with tshark.</p>

<p>If lua is overkill for the task at hand, tshark also offers decent control
over what shows up in the output.  If you want to see all HTTP requests and
their request URI and method, without any other information about the packet,
this tshark command will do the trick:</p>

<div class="highlight"><pre>tshark -T fields -e http.request.method -e http.request.uri -R <span class="s1">&#39;http&#39;</span>
</pre></div>

]]></content:encoded>
    </item>
    <item>
      <title>gnome-screensaver and alternative window managers</title>
      <link>http://byron.theclarkfamily.name/blog/2009/06/30/gnome-screensaver-and-alternative-window-managers</link>
      <pubDate>Tue, 30 Jun 2009 22:15:18 MDT</pubDate>
      <category><![CDATA[psa]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/06/30/gnome-screensaver-and-alternative-window-managers</guid>
      <description>gnome-screensaver and alternative window managers</description>
      <content:encoded><![CDATA[<p>I've been using gnome-screensaver with <a href="http://awesome.naquadah.org/">awesome</a>
   for a while without any problems.  Unfortunately that all came to an end when
   GNOME 2.26 hit Debian Sid last week.  Just so that no-one else has to dig for
   this, gnome-screensaver now uses gnome-session to determine idle time.
   gnome-screensaver will run without gnome-session, but the screensaver and
   locking mechanism will never kick in.  Fortunately, there is an easy fix.  I changed
   my
</p>
<pre><code>gnome-power-manager &amp;
</code></pre><p>line to
</p>
<pre><code>gnome-session &amp;
</code></pre><p>in <code>~/.xsession</code> and everything works now.
</p>]]></content:encoded>
    </item>
    <item>
      <title>pcapy</title>
      <link>http://byron.theclarkfamily.name/blog/2009/05/21/pcapy</link>
      <pubDate>Thu, 21 May 2009 09:21:35 MDT</pubDate>
      <category><![CDATA[python]]></category>
      <category><![CDATA[psa]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/05/21/pcapy</guid>
      <description>pcapy</description>
      <content:encoded><![CDATA[<p>So, <a href="http://oss.coresecurity.com/projects/pcapy.html">pcapy</a> is a great, simple
   library to interface with libpcap.  It works well for reading live packets and
   dump files.  There's only one problem: there is no way to modify or create a
   <code>struct pcap_header</code> from Python code.  So there's really no way to add data to
   the packets and add them to a dump file.
</p>]]></content:encoded>
    </item>
    <item>
      <title>View a Certificate</title>
      <link>http://byron.theclarkfamily.name/blog/2009/05/20/view-a-certificate</link>
      <pubDate>Wed, 20 May 2009 11:10:40 MDT</pubDate>
      <category><![CDATA[tips]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/05/20/view-a-certificate</guid>
      <description>View a Certificate</description>
      <content:encoded><![CDATA[<p>Yet another command I'll never remember unless I write it down.  Here's how to
   view a certificate.  In my case I was viewing a certificate that Mutt had
   stored:
</p>
<pre><code>openssl x509 -in .mutt_certs -noout -text
</code></pre>]]></content:encoded>
    </item>
    <item>
      <title>_hg_ps1()</title>
      <link>http://byron.theclarkfamily.name/blog/2009/03/31/_hg_ps1()</link>
      <pubDate>Tue, 31 Mar 2009 21:23:53 MDT</pubDate>
      <category><![CDATA[mercurial]]></category>
      <category><![CDATA[bash]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/03/31/_hg_ps1()</guid>
      <description>_hg_ps1()</description>
      <content:encoded><![CDATA[
<p>In honor of the <a href="http://mail.python.org/pipermail/python-dev/2009-March/087931.html">decision</a>
to move Python development to <a href="http://www.selenic.com/mercurial">Mercurial</a>, I
decided to write something helpful.  I've found <code>__git_ps1()</code> to be incredibly
useful, so, here's my take on <code>_hg_ps1()</code>:</p>

<div class="highlight"><pre>_hg_root<span class="o">()</span>
<span class="o">{</span>
    <span class="nb">local </span><span class="nv">basedir</span><span class="o">=</span><span class="k">$(</span><span class="nb">pwd</span><span class="k">)</span>

    <span class="k">while</span> <span class="o">[</span> <span class="s1">&#39;/&#39;</span> !<span class="o">=</span> <span class="s2">&quot;${basedir}&quot;</span> <span class="o">]</span>; <span class="k">do</span>
<span class="k">        if</span> <span class="o">[</span> -d <span class="s2">&quot;${basedir}/.hg&quot;</span> <span class="o">]</span>; <span class="k">then</span>
<span class="k">            </span><span class="nb">break</span>;
        <span class="k">fi</span>

<span class="k">        </span><span class="nv">basedir</span><span class="o">=</span><span class="s2">&quot;$(readlink -f &quot;</span><span class="k">${</span><span class="nv">basedir</span><span class="k">}</span>/..<span class="s2">&quot;)&quot;</span>
    <span class="k">done</span>

    <span class="o">[</span> <span class="s1">&#39;/&#39;</span> <span class="o">==</span> <span class="s2">&quot;${basedir}&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">echo</span> -n <span class="s2">&quot;${basedir}&quot;</span>
<span class="o">}</span>

_hg_ps1<span class="o">()</span>
<span class="o">{</span>
    <span class="nb">local </span><span class="nv">g</span><span class="o">=</span><span class="k">$(</span>_hg_root<span class="k">)</span>
    <span class="k">if</span> <span class="o">[</span> -n <span class="s2">&quot;${g}&quot;</span> <span class="o">]</span>; <span class="k">then</span>
<span class="k">        </span><span class="nb">local </span>branch

        <span class="nv">branch</span><span class="o">=</span><span class="k">$(</span>hg branch<span class="k">)</span>
        <span class="k">if</span> <span class="o">[</span> -f <span class="s2">&quot;${g}/.hg/bookmarks.current&quot;</span> <span class="o">]</span>; <span class="k">then</span>
<span class="k">            </span><span class="nv">branch</span><span class="o">=</span><span class="s2">&quot;$(&lt; &quot;</span><span class="k">${</span><span class="nv">g</span><span class="k">}</span>/.hg/bookmarks.current<span class="s2">&quot;):${branch}&quot;</span>
        <span class="k">fi</span>

<span class="k">        if</span> <span class="o">[</span> -n <span class="s2">&quot;${1-}&quot;</span> <span class="o">]</span>; <span class="k">then</span>
<span class="k">            </span><span class="nb">printf</span> <span class="s2">&quot;$1&quot;</span> <span class="s2">&quot;${branch}&quot;</span>
        <span class="k">else</span>
<span class="k">            </span><span class="nb">printf</span> <span class="s2">&quot; (%s)&quot;</span> <span class="s2">&quot;${branch}&quot;</span>
        <span class="k">fi</span>
<span class="k">    fi</span>
<span class="o">}</span>
</pre></div>


<p>Yes, I know that the <code>hg root</code> command does the same thing as my <code>_hg_root()</code>,
but it felt slow running mercurial before printing each prompt.  The only
thing that's missing is showing when merges are in progress. I'll try to add
that the next time I need to do a manual merge.</p>

<p><em>Update:</em> It seems that some of my repositories don't have a <code>.hg/branch</code> file
so I'm calling <code>hg branch</code> for that info.  Also, the <code>readlink</code> line in
<code>_hg_root()</code> did not properly handle spaces.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Saving ViM Macros</title>
      <link>http://byron.theclarkfamily.name/blog/2009/03/11/saving-vim-macros</link>
      <pubDate>Wed, 11 Mar 2009 09:32:01 MDT</pubDate>
      <category><![CDATA[tips]]></category>
      <category><![CDATA[vim]]></category>
      <guid isPermaLink="true">http://byron.theclarkfamily.name/blog/2009/03/11/saving-vim-macros</guid>
      <description>Saving ViM Macros</description>
      <content:encoded><![CDATA[<p>I use ViM macros (aka <code>complex-repeat</code>) all the time. Occasionally, I find that it would be nice to reuse one of my macros across editing sessions. Turns out it's pretty easy to save the macro. Just add a line like the following to a file that gets sourced when your file is opened by ViM (This example is from <code>~/.vim/ftplugin/rst.vim</code>).
</p>
<div class="highlight"><pre><span class="k">let</span> @<span class="k">h</span> <span class="p">=</span> <span class="c">&quot;yypVr&quot;</span>
</pre></div>


<p>Now, whenever I open a ReStructured Text file, I can hit <code>@h</code> and my macro will run.
</p>]]></content:encoded>
    </item>
  </channel>
</rss>
