<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog</title>
    <description></description>
    <link>http://catern.com/</link>
    <atom:link href="http://catern.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 23 Sep 2018 09:49:44 -0400</pubDate>
    <lastBuildDate>Sun, 23 Sep 2018 09:49:44 -0400</lastBuildDate>
    <generator>Jekyll v3.8.3</generator>
    
      <item>
        <title>Timerfd can be emulated with eventfd</title>
        <description>&lt;p&gt;I wrote an article about how &lt;a href=&quot;http://catern.com/posts/timerfd_eventfd.html&quot;&gt;timerfd can be emulated with eventfd&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sat, 22 Sep 2018 00:00:00 -0400</pubDate>
        <link>http://catern.com/2018/09/22/timerfd-eventfd.html</link>
        <guid isPermaLink="true">http://catern.com/2018/09/22/timerfd-eventfd.html</guid>
        
        
      </item>
    
      <item>
        <title>Don't speak public protocols, ship mobile libraries instead</title>
        <description>&lt;p&gt;I wrote a hot take about &lt;a href=&quot;http://catern.com/posts/protocols.html&quot;&gt;not speaking public protocols, but shipping mobile libraries&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 03 Jun 2018 00:00:00 -0400</pubDate>
        <link>http://catern.com/2018/06/03/protocols.html</link>
        <guid isPermaLink="true">http://catern.com/2018/06/03/protocols.html</guid>
        
        
      </item>
    
      <item>
        <title>Monads are inferior to function arguments for effect control</title>
        <description>&lt;p&gt;I wrote a very hot take about how monads are inferior to function arguments for effect control.&lt;/p&gt;

&lt;p&gt;Honestly it’s pretty incoherent and I just wrote it to get it down,
but if you think you can understand my jargon-heavy manic prose, feel free to &lt;a href=&quot;http://catern.com/posts/effects.html&quot;&gt;click through&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sun, 20 May 2018 00:00:00 -0400</pubDate>
        <link>http://catern.com/2018/05/20/effects.html</link>
        <guid isPermaLink="true">http://catern.com/2018/05/20/effects.html</guid>
        
        
      </item>
    
      <item>
        <title>Simple, Fast, Easy Parallelism in Shell Pipelines</title>
        <description>&lt;p&gt;I wrote an article about &lt;a href=&quot;http://catern.com/posts/pipes.html&quot;&gt;parallelism in shell pipelines&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Mon, 18 Jan 2016 00:00:00 -0500</pubDate>
        <link>http://catern.com/2016/01/18/shell-parallelism.html</link>
        <guid isPermaLink="true">http://catern.com/2016/01/18/shell-parallelism.html</guid>
        
        
      </item>
    
      <item>
        <title>Docker Considered Harmful</title>
        <description>&lt;p&gt;I wrote an article about &lt;a href=&quot;http://catern.com/posts/docker.html&quot;&gt;how bad Docker is&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Fri, 01 Jan 2016 07:00:00 -0500</pubDate>
        <link>http://catern.com/2016/01/01/docker-harmful.html</link>
        <guid isPermaLink="true">http://catern.com/2016/01/01/docker-harmful.html</guid>
        
        
      </item>
    
      <item>
        <title>Terminals are weird</title>
        <description>&lt;p&gt;I wrote an article about &lt;a href=&quot;http://catern.com/posts/terminal_quirks.html&quot;&gt;the quirks of terminals&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sat, 20 Dec 2014 16:00:23 -0500</pubDate>
        <link>http://catern.com/2014/12/20/terminal_quirks.html</link>
        <guid isPermaLink="true">http://catern.com/2014/12/20/terminal_quirks.html</guid>
        
        
      </item>
    
      <item>
        <title>Plain text configuration for GNOME</title>
        <description>&lt;p&gt;For a number of reasons,
I like to keep my configuration in plain text.
Plain text can be edited with my favorite text editor,
and it can be version controlled with the same tools as source code.&lt;/p&gt;

&lt;p&gt;I am also a fan of the GNOME desktop.
GNOME uses the gsettings API for configuration;
theoretically, this API could be directly backed by plain text paths.
For performance reasons, however, dconf was created to back this API.&lt;/p&gt;

&lt;p&gt;dconf is basically a hierarchical {dictionary,map,hash-table}, with
/unix/style/paths, each path containing some number of
key-value pairs. Most of the time, the dconf database is compiled
onto disk as a raw datastructure, and mmap’d in for lightning speed
lookup.&lt;/p&gt;

&lt;p&gt;I can use the following command to write out the dconf database
recursively as plain text, starting from the root:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dconf dump / &amp;gt; ~/.config/dconf/user.d/everything.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The result of the dump looks something like the following:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[org/gnome/settings-daemon/peripherals/keyboard]
repeat-interval=uint32 27
delay=uint32 318

[org/gnome/desktop/input-sources]
xkb-options=['caps:ctrl_modifier']
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course, most of the settings in dconf are irrelevant to me, or are machine specific.
I want to find the ones that I actually care about.
I can do this by grepping the dump from dconf, or dumping sub-paths.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dconf dump / | grep terminal &amp;gt; ~/.config/dconf/user.d/myterminalsettings.conf
dconf dump /org/gnome/terminal
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The paths tab-complete, so it’s easy to do some exploration with the latter option.
However, the latter option dumps only partial paths, so you’d need to edit it before loading it back in.
(Or dump it to a nested directory and develop a more elaborate script for loading that uses find(1)…)&lt;/p&gt;

&lt;p&gt;It’s a bit silly to manually guess at which configuration option is which.
So another option is to watch the dconf database as it changes:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dconf watch /
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now change a setting with the graphical interface, and it’ll be printed to STDOUT!
You’ll have to do a small bit of munging to get this into the same format as dconf dump prints, though.
It might be simpler to just dump the path printed.&lt;/p&gt;

&lt;p&gt;After narrowing down the dump, I delete the settings that I don’t care about,
and neatly comment and arrange the rest in multiple files in &lt;code class=&quot;highlighter-rouge&quot;&gt;~/.config/dconf/user.d/&lt;/code&gt;.
You can see my configuration at &lt;a href=&quot;https://github.com/catern/dotfiles/tree/master/home/.config/dconf/user.d&quot;&gt;my dotfiles repo on Github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now, if I want to load those settings back in, it’s simple:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat ~/.config/dconf/user.d/* | dconf load /
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I actually really like this approach.
I can have all the nice features of a plain text configuration,
without the overhead.&lt;/p&gt;

&lt;p&gt;There is also an option, built in to dconf, to store the configuration as plain text,
monitor those files for changes,
and compile them progressively at runtime into the fast binary file that it uses by default.
This is designed to support filesystems where mmap doesn’t work well. (like NFS)
Unfortunately, using this requires changing files in =/etc= at the moment, which I wanted to avoid.
It would be useful if someone would add straightforward support for enabling this from =~/.config=.&lt;/p&gt;
</description>
        <pubDate>Sat, 20 Dec 2014 16:00:23 -0500</pubDate>
        <link>http://catern.com/2014/12/20/plain-text-configuration-gnome.html</link>
        <guid isPermaLink="true">http://catern.com/2014/12/20/plain-text-configuration-gnome.html</guid>
        
        
      </item>
    
      <item>
        <title>The Excellence of libvirt</title>
        <description>&lt;p&gt;I wrote an article about &lt;a href=&quot;http://catern.com/posts/libvirt.html&quot;&gt;libvirt&lt;/a&gt;.&lt;/p&gt;
</description>
        <pubDate>Sat, 20 Dec 2014 16:00:23 -0500</pubDate>
        <link>http://catern.com/2014/12/20/excellence_of_libvirt.html</link>
        <guid isPermaLink="true">http://catern.com/2014/12/20/excellence_of_libvirt.html</guid>
        
        
      </item>
    
      <item>
        <title>A Nexus 7 as a primary computer</title>
        <description>&lt;p&gt;For about a year and a half, I had no laptop, only a &lt;a href=&quot;http://en.wikipedia.org/wiki/Nexus_7_(2012_version)&quot;&gt;2012 Nexus 7&lt;/a&gt;
with a &lt;a href=&quot;http://www.amazon.com/Logitech-920-003390-Tablet-Keyboard-Android/dp/B0054L8N7M&quot;&gt;Bluetooth keyboard&lt;/a&gt;
and a desktop I’d built previously.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/nexus7.jpg&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At the time, I was a student living on campus.
I was always only a short distance away from my room and desktop.
My need for portable computing was limited to when I was out working with a group; most of my work would be done on my desktop whether I had a laptop or not.
So, I was able to try out this maybe-inefficient approach without too much inconvenience.&lt;/p&gt;

&lt;p&gt;This was motivated by my belief that the combination of an ARM tablet and Bluetooth keyboard is technically superior to a traditional laptop.
It is more portable and flexible, has a longer battery life, and the main portion of it can be carried in a pocket.
There is no technical reason why this hardware cannot be used in the same way as a laptop or netbook, with a full operating system.
It’s only the software (that is, Android) running on this hardware that stops it from conquering the market.&lt;/p&gt;

&lt;p&gt;Thus, I tried to install GNU/Linux on the Nexus 7.
I installed several different images, produced by several different projects.
For a short time I used &lt;a href=&quot;https://wiki.ubuntu.com/Nexus7/Installation&quot;&gt;desktop Ubuntu 13.04&lt;/a&gt; running xmonad, Firefox, urxvt, and other GNU/Linux applications.
Unfortunately, support for the hardware was poor,
and &lt;a href=&quot;https://bugs.launchpad.net/ubuntu-nexus7/+bug/1068994&quot;&gt;a bug&lt;/a&gt; made using the touch-screen nearly impossible,
so I reluctantly reverted to Android.&lt;/p&gt;

&lt;p&gt;By far, the Android application I used the most was &lt;a href=&quot;https://play.google.com/store/apps/details?id=sk.vx.connectbot&quot;&gt;VX Connectbot&lt;/a&gt; for SSH access to my desktop.
I work primarily in a tmux sesssion with vim and bash even today, so this suited me.
Besides my browser, &lt;a href=&quot;https://play.google.com/store/apps/details?id=org.mozilla.firefox&quot;&gt;Firefox for Android&lt;/a&gt;, I didn’t consistently use any other Android apps for getting work done.&lt;/p&gt;

&lt;p&gt;However, I believe this made it unusually easy for me to work on the tablet.
I believe someone who does most of their work in a graphical environment would find an Android tablet, even with an external keyboard, difficult to use productively.
Mobile applications usually have only a small feature set.
The Android graphical shell’s capability for multitasking is limited.
Android apps, even browsers, almost totally lack keyboard shortcuts, which forced me to stay close to the touchscreen.
SSH allowed me to bypass these limitations by leaving the host operating system and connecting to another.&lt;/p&gt;

&lt;p&gt;I now own a laptop and use it instead of a tablet.
I like having access to a real browser that has keyboard shortcuts.
And while most of my work is terminal or command-line based, it’s now clear to me that friction in what remains can be a powerful bottleneck. 
Specifically, looking up documentation online or doing research was prohibitvely difficult on the tablet.
It was impossible to have documentation and a terminal open side by side, without using a terminal browser, all of which have rather poor user interfaces.
This is of course a basic feature of any graphical desktop.&lt;/p&gt;

&lt;p&gt;While I still think the hardware is good, the software doesn’t match it.
This is sad, because the GNOME project is producing a top-notch, free software interface that would be great on the Nexus 7 or any other tablet,
while still providing all the features of a traditional desktop and laptop interface.
Sadly, hardware vendors aren’t adventurous enough to make use of the quality free software around them, and are sticking with Android.
For now, I think I’ll be sticking with a laptop until a tablet with good hardware support in GNU/Linux appears.
At that time I will experiment again with a tablet as a primary computer.&lt;/p&gt;
</description>
        <pubDate>Thu, 15 May 2014 00:00:00 -0400</pubDate>
        <link>http://catern.com/2014/05/15/nexus-7-netbook.html</link>
        <guid isPermaLink="true">http://catern.com/2014/05/15/nexus-7-netbook.html</guid>
        
        
      </item>
    
      <item>
        <title>A modern Unix mail setup</title>
        <description>&lt;p&gt;I have tried to get my mail in the traditional Unix way,
with an &lt;a href=&quot;http://en.wikipedia.org/wiki/Email_agent_(infrastructure)&quot;&gt;MTA, MDA, MRA, MUA&lt;/a&gt;, all that stuff.
It was a huge pain.
With some more modern programs, though,
I can have a setup that still follows the Unix philosophy of single-purpose programs working together,
while being a lot easier to understand.&lt;/p&gt;

&lt;p&gt;There are four main programs in my setup:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://offlineimap.org/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;offlineimap&lt;/code&gt;&lt;/a&gt;: fetch mail from servers&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://notmuchmail.org/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch&lt;/code&gt;&lt;/a&gt;: index and search local mail&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://github.com/pazz/alot&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;alot&lt;/code&gt;&lt;/a&gt;: read indexed mail&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://msmtp.sourceforge.net/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;msmtp&lt;/code&gt;&lt;/a&gt;: send mail to servers&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;offlineimap&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;offlineimap&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/offlineimap-logo.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://offlineimap.org/&quot;&gt;offlineimap&lt;/a&gt; connects to the IMAP servers for my gmail and self-hosted mail accounts
and downloads any new mail, according to its account, into a subdirectory of ~/mail/, in Maildir format.&lt;/p&gt;

&lt;p&gt;I also use this &lt;a href=&quot;https://bitbucket.org/raymonad/offlineimap-notify&quot;&gt;offlineimap-notify&lt;/a&gt; script,
which just wraps offlineimap to pop up notifications when new mails are downloaded.
As expected, these notifications are sent over D-Bus,
and are displayed by a daemon which follows the &lt;a href=&quot;https://developer.gnome.org/notification-spec/&quot;&gt;Desktop Notifications Specification&lt;/a&gt;.
(I use &lt;a href=&quot;https://github.com/knopwob/dunst&quot;&gt;dunst&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;offlineimap is configured to run &lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch new&lt;/code&gt; when it finishes syncing.
If notmuch changes anything in the mail directories, offlineimap will sync it back to the IMAP servers.
This means read-status, folder location, deletion-status, etc. are synced back to the IMAP servers and available to other clients (like my phone).&lt;/p&gt;

&lt;h2 id=&quot;notmuch&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/notmuch-logo.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://notmuchmail.org/&quot;&gt;notmuch&lt;/a&gt; indexes the email living in the subdirectories of ~/mail/ and allows for fast search and tagging over them.
It’s implemented on top of &lt;a href=&quot;http://xapian.org/&quot;&gt;xapian&lt;/a&gt;, a text indexing and searching library.
When &lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch new&lt;/code&gt; is run, notmuch inspects the directories it’s responsible for indexing and adds any new mail that’s appeared there to the index.
Since read-status, folder location, and deletion-status are present in the Maildir format, notmuch also adds appropriate tags to represent this information internally.
Then, &lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch search tag:inbox&lt;/code&gt; will show all the mail in my inbox,
and &lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch search &quot;tag:inbox tag:unread&quot;&lt;/code&gt; will show all the unread mail in my inbox.&lt;/p&gt;

&lt;h2 id=&quot;alot&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;alot&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/alot.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When first opened, &lt;a href=&quot;https://github.com/pazz/alot&quot;&gt;alot&lt;/a&gt; runs &lt;code class=&quot;highlighter-rouge&quot;&gt;notmuch search &quot;tag:inbox AND NOT tag:killed&quot;&lt;/code&gt; and displays the results.
I can navigate the results with vi-style bindings, open a specific email, and look through all the emails in that thread.&lt;/p&gt;

&lt;p&gt;I can also compose and send mail.
Composition of mail starts with alot generating a mostly-blank temporary file,
with the contents depending on whether I’m sending a new mail or replying to an existing one
(in the latter case, it will automatically include and quote the existing mail).
As is typical, alot then runs &lt;code class=&quot;highlighter-rouge&quot;&gt;$EDITOR tempfile&lt;/code&gt;, so I can compose my mail in vim or Emacs or whatever I please.
When I close my editor, the updated file appears in alot, and I can add attachments or reopen my editor to do more edits.
When I hit send, the file is passed to msmtp, which reads the headers to learn To, From, etc.&lt;/p&gt;

&lt;p&gt;I also use &lt;a href=&quot;http://www.guru-group.fi/~too/nottoomuch/nottoomuch-addresses/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;nottoomuch-addresses.sh&lt;/code&gt;&lt;/a&gt; to get contacts tab-completion when beginning to compose an email.
This builds up a database of contacts from my notmuch index.
This is a stop-gap solution for me, I hope.
I’d rather use the contacts in my &lt;a href=&quot;http://en.wikipedia.org/wiki/CardDAV&quot;&gt;CardDAV&lt;/a&gt; account, provided by &lt;a href=&quot;http://owncloud.org/&quot;&gt;ownCloud&lt;/a&gt;, but this database is currently close to empty.
Thus I may switch over to using &lt;a href=&quot;https://github.com/geier/pycarddav/&quot;&gt;pyCardDav&lt;/a&gt; for contacts completion at some point.&lt;/p&gt;

&lt;h2 id=&quot;msmtp&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;msmtp&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/msmtp-logo.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://msmtp.sourceforge.net/&quot;&gt;msmtp&lt;/a&gt; connects to the configured SMTP server to send the email.
With multiple configured accounts, it chooses the account and corresponding server based on the provided “From” address.&lt;/p&gt;

&lt;p&gt;msmtp provides &lt;code class=&quot;highlighter-rouge&quot;&gt;sendmail&lt;/code&gt; emulation.
&lt;code class=&quot;highlighter-rouge&quot;&gt;sendmail&lt;/code&gt; is very frequently executed by other programs that wish to send mail.
So sometimes I use the command-line program &lt;code class=&quot;highlighter-rouge&quot;&gt;mail&lt;/code&gt;,
from &lt;a href=&quot;https://www.archlinux.org/packages/core/x86_64/s-nail/&quot;&gt;s-nail&lt;/a&gt;,
to send small emails or attachments, since it just calls out to &lt;code class=&quot;highlighter-rouge&quot;&gt;sendmail&lt;/code&gt;
Likewise when I started toying with kernel development, &lt;code class=&quot;highlighter-rouge&quot;&gt;git send-email&lt;/code&gt; worked out of the box,
and when I tried sending mail from Emacs, it also worked with no setup.
I’m sure I’ll run into other Unix utilities that also invoke &lt;code class=&quot;highlighter-rouge&quot;&gt;sendmail&lt;/code&gt;,
and pleasingly work with no additional configuration thanks to my use of msmtp.&lt;/p&gt;
</description>
        <pubDate>Thu, 15 May 2014 00:00:00 -0400</pubDate>
        <link>http://catern.com/2014/05/15/mail-setup.html</link>
        <guid isPermaLink="true">http://catern.com/2014/05/15/mail-setup.html</guid>
        
        
      </item>
    
  </channel>
</rss>
