less is more or usable clickpad


One of the unfair advantages of Apple hardware is the quality of their touchpads.

The synaptics clickpad in my yoga 2 ain’t Apple-quality, that’s for sure. It’s still quite nice to use, though, but the default configuration is pretty conservative. Here’s what makes it working for me on xenial with x11:

  • The libinput driver. Tweaking the synaptics one is an interesting exercise if one has hours for experimentation, but, ultimately, one will fail. So, let’s get rid of synaptics and make sure it’s libinput (requires X11 session restart):
sudo apt purge xserver-xorg-input-synaptics
sudo apt install xserver-xorg-input-libinput
  • No soft buttons. Soft buttons are evil. One-, two- and three-finger clicks are fine. Also, tapping is good.
#!/usr/bin/env bash

xinput --set-prop "SynPS/2 Synaptics TouchPad" "libinput Click Method Enabled" 0 1
xinput --set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1

(I’m lazy, so this gets executed on every login instead of being put into an X11 configuration snippet.)

go the fuck to sleep


intro, where complaints are made excessively

Note: this short article in no way criticises systemd. It’s not systemd's fault, that – while it provides a nice framework for managing various power states – it does not come with any built-in functionality besides bare kernel interface. If that works for you and you don’t need to handle any quirks of your hardware, you don’t need this article.

But I digress. Until systemd's suspend and hibernate will provide the same functionality as pm-utils, one might just want to tell systemd to use pm-utils. It’s easy enough to do.

the actual part where things are described

Disclaimer: I take no responsibility for any damage this might do to any system. I’m assuming that the reader knows what they’re doing and are reasonably familiar with command line interface and systemd.

First, let’s install pm-utils. On Debian-based systems apt-get install pm-utils will do nicely.

Second, let’s locate the relevant service files. On Debian-based systems one or more of the following files should do:


As I’m not using hibernation or hybrid sleep, I’ve decided to override only the suspend service so I’ve put the following into /etc/systemd/system/systemd-suspend.service:

#  Use pm-utils instead of systemd-sleep



The only relevant change here is to replace the systemd-sleep binary in the ExecStart= stanza with pm-suspend.

Reloading the systemd configuration (systemd daemon-reload) or restarting it (systemd daemon-reexec) should do the trick. (One could probably also use systemctl edit systemd-suspend.service, but I’m new to this whole systemd thingy.)

(Note: this is a shortcut. It’s absolutely possible to port all functionality of pm-utils to use the framework provided by systemd – I just haven’t had enough time to do that. See systemd-sleep(8) and systemd-sleep.conf(5) manpages for more information.)

TIL: Fira Sans font considered invisible.


…well, some versions of it. On some systems. Sometimes.

Apparently the version from Google Web Fonts that I’ve been using until today is not rendered properly on some versions of some Linux distributions. Apparently the problem is known and the temporary fix is to not use Google Web Fonts as a source for this font.

…it would be nice if debugging the issue wouldn’t have taken a combined one man-hour of two reasonably knowledgeable people.

Reproducible results. Computing. Does not compute.

New GPG key


I’m finally moving to more secure GPG key, replacing the more-than-decade-old 1024 bit DSA key with a new 4096 bit RSA one. I’ve uploaded the new key to the pool.sks-keyserver.net and am publishing here my transition statement (which is a complete ripoff of the one suggested by the best practice document). The transition statement is signed by my two keys, old and new.

Hash: SHA1,SHA512

Key transition statement

From: Miroslaw Baran
Date: 22/11/2014

I've recently set up a new OpenPGP key, and will be transitioning away
from my old one.

The old key will continue to be valid for some time, but i prefer all
future correspondence to come to the new one. I would also like this
new key to be re-integrated into the web of trust. This message is
signed by both keys to certify the transition.

the old key was:
pub   1024D/0x8F3B66A6FC494FC4 2000-12-06
      Key fingerprint = DDBE 8A23 7348 1CA7 FC91  56CC 8F3B 66A6 FC49 4FC4

And the new key is:
pub   4096R/0x5931F4435518D7D3 2014-11-16 [expires: 2016-11-15]
      Key fingerprint = EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3

To fetch the full key from a public key server, you can simply do:
  gpg --keyserver pool.sks-keyservers.net 
    --recv-key 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3'

If you already know my old key, you can now verify that the new key is
signed by the old one:
  gpg --check-sigs 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3'

If you don't already know my old key, or you just want to be double
extra paranoid, you can check the fingerprint against the one above:
  gpg --fingerprint 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3'

If you are satisfied that you've got the right key, and the UIDs match
what you expect, I'd appreciate it if you would sign my key. You can do
that by issuing the following command:

NOTE: if you have previously signed my key but did a local-only
signature (lsign), you will not want to issue the following, instead
you will want to use `--lsign-key`, and not send the signatures to the

  gpg --sign-key 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3'

I'd like to receive your signatures on my key. You can either send me
an e-mail with the new signatures (if you have a functional MTA on
your system):
  gpg --export 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3' |
  gpg --encrypt -r 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3' --armor |
  mail -s 'OpenPGP Signatures' '<miroslaw+a+signatures@makabra.org>'

Additionally, I highly recommend that you implement a mechanism to keep
your key material up-to-date so that you obtain the latest revocations,
and other updates in a timely manner. You can do regular key updates by
using parcimonie to refresh your keyring. Parcimonie is a daemon that
slowly refreshes your keyring from a keyserver over Tor. It uses
a randomized sleep, and fresh tor circuits for each key. The purpose is
to make it hard for an attacker to correlate the key updates with your

I also highly recommend checking out the excellent Riseup GPG best
practices doc, from which I stole all of the text for this transition
message: <https://we.riseup.net/debian/openpgp-best-practices>.

Please let me know if you have any questions, or problems, and sorry
for the inconvenience.

Miroslaw Baran


To verify the signatures on the transition statement you may need first to download my new key:

  gpg --keyserver pool.sks-keyservers.net \
    --recv-key 'EDFF 6C46 1AC1 4AB2 7CC8  02C2 5931 F443 5518 D7D3'

and then execute the following:

  wget -qO - https://makabra.org/gpg-key-transition-20141122.md.asc |
    gpg --verify

If you’ve signed my old key and are happy with the result of the verification, please do consider signing my new key too.

A hack most terrible


XSL stylesheet for transforming XML jabber-GG transport user data into spectrum2 sqlite user database:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" indent="no"/>

<xsl:template match="/user">
  INSERT OR REPLACE INTO users (jid, uin, password, language, encoding, last_login, vip)
    ('<xsl:value-of select="/user/jid"/>',
     '<xsl:value-of select="/user/uin"/>',
     '<xsl:value-of select="/user/password"/>',

<xsl:for-each select="/user/userlist/contact">
  INSERT INTO buddies (user_id, uin, subscription, groups, nickname, flags)
       '<xsl:value-of select="@uin"/>',
       '<xsl:value-of select="@subscribe"/>',
       'Transport Gadu-Gadu',
     from users where uin='<xsl:value-of select="/user/uin"/>';

  INSERT INTO users_settings (user_id, var, type, value)
    select id, 'enable_transport', 4, '1' from users where uin='<xsl:value-of select="/user/uin"/>';
  INSERT INTO users_settings (user_id, var, type, value)
    select id, 'send_headlines', 4, '0' from users where uin='<xsl:value-of select="/user/uin"/>';
  INSERT INTO users_settings (user_id, var, type, value)
    select id, 'stay_connected', 4, '0' from users where uin='<xsl:value-of select="/user/uin"/>';


I’m almost sorry. (It worked, though.)



the whys

I’ve planned to play with one or another source code management platform since quite a time, but only recently have found enough time to actually try it.

My criteria were very far from professional: I was looking for a project that:

  • is functional enough that using it instead of github won’t be too much of a pain,
  • is easy enough to install (from zero to functional installation in five hours time tops, and that including reading the documentation for the first time),
  • runs well on apache (because I already have a reasonably well-configured apache instance running),
  • works with mysql (like with the apache, I already have well-tuned mysql instance),
  • last but not least, relies on packaged software only (because I am lazy)

That unfortunately ruled out redmine and all ruby-on-rails-based github clones out there, including the otherwise appealing gitorious. The most interesting contender from the python side of the world – rhodecode – switched from free software to closed source, and the only other name I remembered was phabricator.

I’ve heard about the project for the first time during one of Facebook Dublin’s Infrastructure Open House meetings and it definitely piqued my interest then – it is, basically, an integrated software engineering platform that’s used by Facebook internally to manage all their code. It is also an open source project available under Apache licence. Written in well-managed PHP, it runs – or is advertised to run – on almost everything.

the hows

Upstream guides for both installation and setup are quite good, notes below handle the differences.

difference #1: apache + mod_fcgid + worker mpm

I have mod_fcgid configured to use a wrapper script from a directory that’s mapped to the /fcgi-bin alias:

<IfModule mod_fcgid.c>
    AddType application/x-php         php phtml php3
    AddType application/x-php-source  phps
    AddHandler php-fcgid .php
    Action php-fcgid /fcgi-bin/php-fcgi-wrapper
    Alias /fcgi-bin/ /var/www/fcgi-bin.d/php5-default/

    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
      SetHandler php-fcgid

    <Location /fcgi-bin/>
        SetHandler fcgid-script
        Options +ExecCGI

For Phabricator to work with this configuration you have to add the first rewrite rule, to make sure that the fcgi invocations will not be touched – if the path to the fcgi handler is not whitelisted, the last rule with its greedy regex will break the php fcgi execution.

    RewriteRule ^/fcgi-bin            -                       [L]
    RewriteRule ^/rsrc/(.*)           -                       [L,QSA]
    RewriteRule ^/favicon.ico         -                       [L,QSA]
    RewriteRule ^(.*)$                /index.php?__path__=$1  [B,L,QSA]

difference#2: managing phd through init daemon

I’m using the following service file to keep the phd services up:

Description=the phabricator daemon service
After=syslog.target network.target remote-fs.target nss-lookup.target

ExecStart=/srv/blueprint/phabricator/bin/phd start
ExecStop=/srv/blueprint/phabricator/bin/phd stop


difference#3: make diffusion’s ssh service listen on a custom port

I’m using ‘vcs’ as the user name and decided to run customised ssh service listening on ports 22 and 2401 on a dedicated IP to manage the ssh-based VCS operations. (The openssh-server package from wheezy backports is needed for the AuthorizedKeysCommand support.)


Description=phabricator ssh service
After=network.target auditd.service phd.service

ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
ExecReload=/bin/kill -HUP $MAINPID



# (line breaks for clarity)
SSHD_OPTS="-f /etc/ssh/sshd_config_phabricator \
           -h /etc/ssh/ssh_host_dsa_key \
           -h /etc/ssh/ssh_host_rsa_key \
           -h /etc/ssh/ssh_host_ecdsa_key"


# NOTE: You must have OpenSSHD 6.2 or newer; support for AuthorizedKeysCommand
# was added in this version.

AuthorizedKeysCommandUser vcs
AuthorizedKeysCommand /usr/local/lib/phabricator/bin/ssh-hook
AllowUsers vcs

# You may need to tweak these options, but mostly they just turn off everything
# dangerous.

ListenAddress [2a01:4f8:200:20e2:1::c]:22
ListenAddress [2a01:4f8:200:20e2:1::c]:2401
Protocol 2
PermitRootLogin no
AllowAgentForwarding no
AllowTcpForwarding no
PrintMotd no
PrintLastLog no
PasswordAuthentication no
AuthorizedKeysFile none

PidFile /var/run/phabricator-sshd.pid

the results

Fully featured phabricator installation, with git, mercurial and svn available through https and ssh protocols, project/task management, wiki, pastebin clone etc., with LDAP and github account integration.

Not too bad for a Sunday afternoon project, if I may say so myself.