SparQ Notes

Various notes about miscellaneous stuff.

Table of Contents

1 Tools and Environment

1.1 NixOS

Using NixOS gives me a lot of freedom in not having to worry about system or package upgrades not being backward compatible or breaking older things.

I used Gentoo for quite a while, but they were fond of adding inflection point changes, so if you didn't upgrade your system for a while you had to go dig out all the information about how to do that change. If you let your system get too old (and several of these incompatible changes had been released) then you were done and had to re-install.

I tried Arch, and it was worse in this aspect. You were expected to keep your system very fresh (no older than about a week) or you would get bit by these changes.

Gobolinux was quite interesting, especially with the non-FSB approach to storing packages as well as unionfs builds based on dependencies. The Recipe system was also pretty powerful and nice and brief. However, Gobolinux still had package maintenance/compatibility issues and a small enough user base that it was hard for it to stay current.

NixOS seems to solve all of the above issues. The primary issue with NixOS is getting something it doesn't provide can be more difficult, particularly because there have been some changes over time (SVN -> git -> channels) that I haven't followed closely.

My /etc/nixos/configuration.nix file.

1.2 Xmonad

Very nice window manager, with more features or configuration modes than just about any other on the market, while maintaining a minimalistic tiled approach to the desktop, which maximizes utility while minimizing useless eye candy. Yes, I'm that kind of guy.

My ~/.xmonad/xmonad.hs file.

1.3 urxvt

I use urxvt for my terminal sessions. It has the most capability and smallest footprint.

I did find mosh interesting, especially for restartable remote sessions, but mosh had 2 problems:

  1. scrollback support
  2. only one session to the remote can easily be established because a local connect port is chosen based on the remote system name. Multiple connections to the remote system would require manual specification of different ports.

When using urxvt, it can be configured to automatically launch a browser on request when URLs are recognized.


URxvt.perl-ext-common: default,matcher
URxvt.keysym.C-Delete:  perl:matcher:last
URxvt.keysym.M-Delete:  perl:matcher:list
URxvt.url-launcher:     /home/kquick/local/bin/
URxvt.matcher.button:  1

This also needs a helper script (as defined at which is found in my ~/local/bin as referenced by my PATH environment variable:

uzbl-browser --uri "$@" &

With this setting any URL from the most recent output is highlighted and I can click on it with Mouse button 1 or auto-select it via Control+Del to have it opened in a new uzbl window. I can also use Mod-Del (Left-Alt) to select from a list of recent URL outputs.

1.4 uzbl

Most of my high-end browsing is done with Opera, which is a very nice and feature-full browser. It can be used to do email, IRC, and RSS feeds as well, which are great built-in features at times.

However, one of the problems is that I accumulate dozens of open tabs in Opera and this turns my Opera sessions into huge beasts. This is worsened by the fact that there are some websites that have something (lots of Java? Javascript? other?) that turn out to be memory pigs. Big time. So periodically I have to restart Opera to restore reasonable memory utilization, but that's also a pain with the large number of open tabs.

To try a different approach, I am now trying uzbl as a lightweight browsing tool for specific browsing needs. I can still use Opera for the high-end stuff, but uzbl provides a quick and fast method for quickly viewing HTML.

In the urxvt section above, I show how I have configured urxvt to recognize URLs and automatically open them with uzbl.

In the uzbl configuration file, I had to tell uzbl where to find the NixOS installed cert file:


set ssl_ca_file = /etc/ca-bundle.crt

I also installed youtube-dl and setup a "ytdl" shortcut to download the youtube video in mp4 format and play it locally, removing the need for flashplayer (on youtube, at least).


@cbind ytdl = sh


cd ~/Downloads #  where the file is saved
youtube-dl -o %\(title\)s.%\(ext\)s "$UZBL_URI" # -o output template is optional
mplayer -really-quiet "$(youtube-dl -o %\(title\)s.%\(ext\)s --get-filename "$UZBL_URI")"

1.5 mbsync

I use mbsync to synchronize mail folders (including inboxes) between my remote sites and the local machine via IMAP.

1.6 mu4e

I use the mu4e emacs mail reader, which allows me to quickly and easily deal with mail. Any html mail is—as ever in a text screen—a bit of a PITA.


(add-to-list 'load-path "/home/kquick/.nix-profile/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'org-mu4e)
 mu4e-maildir       "~/Maildir"   ;; top-level Maildir
 mu4e-sent-folder   "/sent"       ;; folder for sent messages
 mu4e-drafts-folder "/drafts"     ;; unfinished messages
 mu4e-trash-folder  "/trash"      ;; trashed messages
 mu4e-refile-folder "/archive"    ;; saved messages
 mu4e-get-mail-command "mbsync main-accounts"
 mu4e-update-interval 300             ;; update every 5 minutes
 mu4e-headers-fields '((:date . 16) (:flags . 6) (:size . 6) (:from-or-to . 22) (:subject))
 mu4e-headers-date-format "%y-%b-%d %k:%M" ;; "%x %X"
 mu4e-use-fancy-chars t
 mu4e-view-show-images t
 mu4e-view-image-max-width 800
(add-hook 'mu4e-compose-pre-hook
                         (defun my-set-from-address ()
                                "Set the From address based on the To address of the original."
                                (let (msg mu4e-compose-parent-message) ;; msg is shorter...
                                  (if msg
                                                (setq user-mail-address
                                                                 ((mu4e-message-contact-field-matches msg :to "")
                                                                 ((mu4e-message-contact-field-matches msg :to "")
                                                                 ((mu4e-message-contact-field-matches msg :to "")
                                                                 (t "")))
                                         (setq user-mail-address "")))))
(add-to-list 'mu4e-bookmarks '("subject:Haskell"    "Haskell Cafe"     ?h) t)
(add-to-list 'mu4e-bookmarks '("subject:fossil"     "Fossil SCM"       ?f) t)
(add-to-list 'mu4e-bookmarks '("subject:darcs"      "Darcs SCM"        ?d) t)
(add-to-list 'mu4e-bookmarks '("subject:Nix"        "Nix"              ?n) t)

1.7 org-mode

I use Emacs org-mode to manage notes and agenda items, and link to diary entries.


1 Note that most other environments will just use #!/bin/sh for that first line, but with NixOS the generic "current sh" requires a little more specificity.

Date: 2013-05-01T21:42-0700

Author: Kevin Quick

Org version 7.9.3f with Emacs version 24

Validate XHTML 1.0