New header banner

Blackies Pepe and Jdbd have provided this site with a much needed header banner.

Kudos to them!

Better keyboard handling in

Apple OSX’s default terminal application,, has matured quite a bit over the last years. It offers a good balance between compatibility with modern shells, nice font rendering and a functional user interface with support for tabs. For people comming from other operating systems however, it’s a bit frustrating getting used to mac’s keyboard shortcuts.

The default behaviour of home, end and page keys is specially traumatic, so after googling a fair bit1 I came up with the following recipies.

Key Action Behaviour
home \033[1~ Move to the start of the line
end \033[4~ Move to the end of the line
page up \033[5~ Search previous in the history
page down \033[6~ Search next in the history
option left \033b Move one word left
option right \033f Move one word right
forward delete \033[3~ Delete next char

To change the behaviour of a key on we need to access the preferences and navigate to the keyboard tab. There we can modify and create new key mappings. To input \033 just press the Esc key.

Now for they to work properly we need configure readline by either editing as root /etc/inputrc or just creating an user file at ~/.inputrc

# Be 8bit clean
set input-meta on
set output-meta on
set convert-meta off

# allow the use of Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line

# allow the use of Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert

# page up/down to search history
"\e[5~": history-search-backward
"\e[6~": history-search-forward

Time to restart your terminal session and get all the previous changes to work.

By the way, if you work with tabs there are two lesser known keyboard shortcuts to change between them: Cmd+Shift+Left and Cmd+Shift+Right will change the active tab to the left or the right.

As a bonus, we can modify all Cocoa based apps (Safari, Word, Mail …) to behave a bit more as our newly configured terminal by creating a custom keyboard binding in ~/Library/KeyBindings/DefaultKeyBinding.dict:

    "\UF729" = "moveToBeginningOfLine:"; 
    "\UF72B" = "moveToEndOfLine:"; 
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";
    "\UF72C" = "pageUp:"; 
    "\UF72D" = "pageDown:"; 
    "$\UF72C" = "pageUpAndModifySelection:"; 
    "$\UF72D" = "pageDownAndModifySelection:"; 

Consolidate e-mail accounts in GMail

Over time GMail has been giving options to easily consolidate email accounts with them, however they offer it under its conditions, which might not always match your requirements.

For example, they allow to fetch mail from a remote account with POP3 only, not IMAP. Moreover, the frequency by which they fetch new mails is not very reliable, going from 5 minutes to upto an hour!

Recently they introduced the posibility to use a remote SMTP server to deliver emails from consolidated email addresses, fixing the issue with Outlook mail clients displaying the infamous “on behalf of” tag. However they only support remote SMTP servers offering secured connections (TLS) or at least secured logins (STARTTLS).

To solve the mail forwarding issue, a veteran program by the name of fetchmail can be easily used. Here is my config to fetch email via the IMAP protocol and forward it using a sendmail like command line MDA tool.

In /etc/fetchmailrc

set daemon 120

poll MY.IMAP.SERVER imap
    smtpname ""
    mda '/usr/sbin/sendmail'

Fetchmail will even allow to specify which IMAP folders to fetch, so you can configure it to also forward your Sent folder for example.

Since I didn’t want to install a full SMTP server just for forwarding the email, I went with msmtp, which is a SMTP client for relaying to a SMTP mailhub or smart host. Note that we can’t use GMail’s SMTP server for this task, since it’ll rewrite the From header from the messages, meaning that all the emails will look like they come from ourselves.

In /etc/msmtprc

tls off
logfile /var/log/msmtp.log

account MY_ACCOUNT
port 25
auth login

account default : MY_ACCOUNT

msmtp should install a symlink under /usr/sbin/sendmail so it gets somewhat compatible with it for the most simple tasks. Note that it won’t do local delivery but instead connect to the configured SMTP server to relay the email messages.

With this setup I can get new messages almost instantly in GMail. Now I needed to solve the use of a custom SMTP server in GMail, to avoid the “on behalf of” issue with Outlook recipients.

Since the SMTP server of my consolidated account didn’t offer TLS neither STARTTLS, I had to create a secure tunnel for it in my hosting server with stunnel. You can learn to generate a certificate for the SSL connections from its site and documentation. What follows is just the section of the configuration to secure the SMTP tunnel.

accept = 587
protocol = smtp

Now in GMail settings I can simply configure a remote SMTP server for my consolidated email by using the address of the server running the tunnel on port 587, which upon a connection will proxy the request to the actual remote SMTP server.

Finally I have a really consolidated external email address in GMail. The setup is quite easy to implement and light on resources.

Migrating the blog to Jekyll

Since I barely post anything new in this blog any more I thought that migrate it to a new system might bring some more life to it. It started years ago running on Textpattern, then I migrated to Drupal since I wanted to experiment with it a bit and now it’s being generated with Jekyll.

The former two use a database for persistence of the content while the later, Jekyll, generates static files from the content which are then uploaded to the web server hosting this blog. The change has been quite nice, since now I don’t need to login into a CMS administration web panel and get lost in the little details of each publishing system. My workflow is improved because I’m forced now to write the content using my preferred text editor, even when I’m offline, allowing me to concentrate on the content instead of the tool.

Even if publishing gets a bit more complicated, involving rsync‘ing the new content on my laptop with the published html files in the server, there is a great advantage in having a system which generates a static rendition of the site. Since no database or interpreted language is needed, the runtime can be served with a very simple and efficient setup. It’s allowed me to bring down the server steady memory usage from 120Mb of my previous LAMP setup to a mere 30Mb of the current nginx one.