Saturday, April 25, 2015


Playing with iptables/nftables I wrote following simple wrapper scripts.

To list all existing tables:

To flush/clear all existing tables:

Friday, April 3, 2015

Simple Mail Notification

I synchronize mailboxes with mbsync and read email in Mutt (more specifically my patched version). By default Mutt will check for new email to be found in configured mailboxes, echo simple notification in its window and if configured so ring a bell, which will in turn highlight such urgent workspace in status bar (echoed by window manager — XMonad — and read on STDIN by Xmobar).

Because I get a lot of emails (from mailing lists, VCS commits, etc.) I categorize them into separate folders / mailboxes but really want to be directly notified only for emails found in INBOX. All other emails are processed by batch-like approach something like twice a day. So not to miss something important, I want to get alarmed on INBOX and possibly other specific mailboxes.

I've came up with a simple, rather generic solution utilizing inotify. It continuously monitors configured Maildir directories for changes, and produces line-oriented formatted output (number of new emails, followed by delta from a last wakeup). It also echoes some colors understood by Xmobar, which is also a place from which it gets started by CommandReader plugin.


Friday, March 6, 2015

Linux Console with Non-Blinking Block Hardware Cursor

By default linux console gets you hardware cursor (underlined and blinking). However, it's possible to change this with an appropriate terminal escape sequence. To get rid of blinking one has to enable software cursor instead. I've found that \E[?112c works reasonably well (gray background, with a bit dimmed foreground), however contrast is not that great and I haven't found a way to configure foreground color at all (instead setting it controls how much dimmed foreground will be).

I was wondering if there is a way to keep hardware cursor and just turn blinking off, since it's only way I've found to have true reverse cursor. Eventually, I've managed to do just that with following udev rule.

ACTION=="add|change", KERNEL=="fbcon", SUBSYSTEM=="graphics", ATTR{cursor_blink}="0"

Then edit linux terminfo entry (and install it globally).

$ infocmp -A /usr/share/terminfo linux linux
comparing linux to linux.
    comparing booleans.
    comparing numbers.
    comparing strings.
        cnorm: '\E[?25h\E[?0c', '\E[?25h\E[?8c'.
        rs2: NULL, '\E[?25h\E[?8c'.

To achieve same for agetty login, prepend rs2 value to /etc/issue.

Tuesday, October 14, 2014

Wild Pinentry

Using `pinentry-curses` gets you pretty nice pinentry curses interface. But it turns your machine into an increasingly heating device once you bring it up without proper terminal set. This should not happen normally, because you are responsible for setting `GPG_TTY` correctly. Still, there are situations when you can't reliably do that. It would be a good thing if pinentry can verify that it talks to real terminal instead of going wild.

Lo and behold, here is my patched version.