Running unattented systemd user service

In the process of learning how to deploy a Django webapp using Microsoft’s TFS build + release tools, I came across the need to convert several systemd services that used to be started by root  user to systemd user services, so that they could be started and managed by a non-privileged user. Here is one of my original services that is used to run gunicorn (*** designates values that have been redacted):

I ran these steps to convert the original service to a user service:

To my surprise, that worked well and the service has started without complaints. However, I soon discovered two problems:

  1. The service no longer started automatically after server reboot
  2. The service only ran when I was SSHed into the server as the user who now managed the service

Turns out, the fix for both issue is relatively straight-forward, once you know what to do, which is the hard part. In order to fix the first problem, I ended up changing the service file:

It turns out that such thing as does not exist for systemd user services, but does.

The second issue was a bit more interesting. Roughly speaking, systemd only runs user services when a user is logged in. When the user logs out, their services are promptly stopped. In order to overcome that, you need to indicate to the login manager that user needs to linger. On Ubuntu 16.04, the command to do so is:

After applying both changes and rebooting, my systemd user services where chugging along happily without the need for manual intervention.

Arduino Bunny Light

I built an Arduino nightlight that looks like a bunny.


I was inspired by this blog post on Sparkfun. However, I wanted to do something more complex in terms of lightning. The bunny shape was laser cut from acrylic and a simple circuit board was assembled to host two RGB LEDs that connected, along with a button, to an Arduno Nano board.

There are three modes for this nighlight:

  1. solid color (five colors pre-loaded; those can be rotated through by a short button press) The single button press controls the light mode:
  2. pulsating color (same five colors; those can also be rotated through by a short button press)
  3. crossfading light (uses the same five colors).

The long button press activates one of the sleep mode durations (turning the light off after 15 / 30 / 60 minutes). A short button press after the sleep mode was activated will cancel it.

This GitHub page contains the code and circuit design files.

One thousand origami cranes…

From the Wikipedia article: Thousand Origami Cranes (千羽鶴 Senbazuru) is a group of one thousand origami paper cranes held together by strings. An ancient Japanese legend promises that anyone who folds a thousand origami cranes will be granted a wish by the Gods. Some stories believe you are granted eternal
good luck, instead of just one wish, such as long life or recovery from illness or injury.20160321_182222

It turns out that even if one has no particular skill at origami, if one folds something about 1000 and five times, one gets surprisingly good.

Here is some stats I’ve gathered on the process:

  • The whole project has lasted for 252 days, I have only spent 41 days actually folding.
  • On average, I made about 24 cranes at a time. There have been at least 10 days where I’ve made only 10 cranes and two very productive days where I’ve made 70. Further to this, I made 20 on 16 different occasions, 30 on 4 different occasions, 40 on 6 different occasions and 50 on 1 occasion.
  • The longest streak was 9 days in March and the longest break was for 64 days.

Unfortunately I did not time myself, but I am pretty sure I can fold a crane in under a minute now. I recommend this project for everyone who feels guilty watching Netflix and not doing anything “useful” – now you can pretend you are being productive.

Update June 1, 2016: and here is the finished product…



False hope…

Due to a change in the number of years you have been claims free, we are pleased to advise your premium has been reduced…

Screenshot from 2016-02-17 17:49:17

Um… thanks? It’s likely that the insurance company simply has not thought this scenario through but given that just a few months ago I got adjusted up by $20-30 because reasons, this looks facetious.

Managing your DigitalOcean MySQL databases with MySQL Workbench

I am trying out the excellent DigitalOcean to host this blog along with a few other personal projects. This is my first time using a dedicated VPS for hosting and while it provides me with a great deal of control over my resources, one obvious down side is that I am also directly responsible for all system administration work. Instead of trying to install phpMyAdmin to administer my database or mocking with iptables, I’ve decided to use SSH tunneling and MySQL Workbench to do just that.

You can use the following command to tunnel the remote port 3306 of your VPS to the locally available port 8888:

If all worked well, you will be logged into your remote machine and, while keeping that terminal window open, you will be able to use MySQL Workbench to connect to in order to access your database. By the way, you don’t have to use  8888 for your local port, I use  3306 locally as well, in which case the command becomes: