This post is still a work-in-progress. A few friends have asked for recommendations of places to visit and things to do in Singapore. So here is a list of my favourite things that I think are easy to overlook.

Read more…

Restoring Original Android Firmware on Xperia ZR

Recently I decided to try out Android Pay and found that my new phone doesn’t have NFC, and that the app refused to work on my old phone because it ran CyanogenMod. Fortunately after a little research I found restoring isn’t that hard.

Read more…

So you want a better FS?

Recently having strange performance spikes with the loopback image I have been using since forever, I bit the bullet and gave Btrfs a try.

First let’s address the elephant in the room: “Is Btrfs stable yet”? The wiki has your answer. I’ll give you mine: If it’s stable enough for kernel developers to use on their workstations for 4 years, it’s stable enough for me.

Read more…

DigitalOcean doesn't allow SMTP connections via IPv6

Update: as pointed out by p1mrx, this is caused by DigitalOcean’s blocking some mail related IPv6 traffic to avoid abuse, similar to what’s described in IPv6 on Digital Ocean is crippled.

TLDR: Gmail appears to support IPv6 for SMTP by broadcasting an IPv6 address for its IMAP and SMTP services. However, whatever behind the IPv6 address doesn’t accept SMTP connections.

Read more…

Running Linux with a bare window manager

The most efficient way to run GUI applications is to run a display server and a window manager.

Despite efforts like Wayland and Mir, X.Org is still the de facto display server. It is enabled by default almost everywhere so you don’t need to do anything about it.

You just need to choose a window manager. Compiz comes by default with Ubuntu so it’s a good choice if you don’t want to install new stuff yet. Openbox is also a sane choice. Xmonad is my favorite, so I’m going to use it as the example here.1

  1. This post was adapted from an [ snapshot][4] of my old blog 

Read more…

Malaysia GrabCar Etiquette

Recently I had a chance to come back to Malaysia for a few days and was introduced to a few “rules” when using GrabCar, a taxi-like service that some refer to as “anti-taxi”.

Read more…

OpenSSL Ciphers for Forward Secrecy

Update: current Nginx (1.10.1) and OpenSSL (1.0.2h) have good defaults. None of this is needed anymore \o/

In a search to ensure forward secrecy on all servers I manage, I needed to figure out a list of ciphers I want to use. There are numerous articles on the web that tells you what to use, but they are either vague about what really to use, or give you a long list of things you don’t know or care about. After quite some reading and experimenting I finally got a grasp of it, and the end result is not as scary as what those articles say.

There is also a tldr at the end for the lazy ;)

Read more…

fooCam: Useful Enough to Be Copied

In August 2013, I started working on fooCam. It’s a little app that scratches my own itch. I quickly got the app to do everything I wanted it to do, slapped the MPL on it and submitted it to F-Droid. Without any intention to monetize, I did not want to spend $25 to submit the app to Google Play Store. All went well until today, GitHub user @programmin1 informed me that the app is already on Google Play Store.

Read more…

Checking Amanda Backups

Recently I was taken aback to find that my Amanda backups didn’t contain files. Not even a single file! All that I had backed up were empty directories. Luckily it was part of a check and I didn’t lose anything. The incident, however, reminded me of the biggest problem with backups: you don’t want to realize that your backups are broken when you need to restore something. That motivated me to write a script that simulates what I will do when I need to get a backed up version of something. Writing the script taught me a few things about threading in Python, which was totally unexpected, but exciting.

Read more…

Docker vs Chef and Vagrant

Docker seems to be the new hotness in the devops world. It runs applications in isolated containers, providing the benefits of virtualization without the hassle of virtual machines. Today is a Cogini Hackday, and I chose to dive into Docker. This is still a very young project, but it has the potential to change the way we do software development and deployment. I’m going to compare Docker with Cogini’s current best practice :)

Read more…

On Being Perfect

A long long time ago…

Actually not that long ago, a friend and I were talked about perfection. During the half-joke half-serious discussion we came across the term “perfectly stupid”, which seemed to be one of the floweriest insults we knew at the time (we were secondary school kids at time, by the way). Since then I have heard of many jokes aiming at people’s lack of brilliance, though I haven’t heard any that I would call “perfect”. The word “perfect” is just that far away for me.

Then my friend suddenly thought about reversing the words, so we had “stupidly perfect” and start to wonder, which of the two combination carried more insult.

Read more…

Powerline Revisited

After incorporating Powerline into my dotfiles I got a very good looking prompt for Bash and Zsh, plus a nice status line for Tmux and Vim. I quickly noticed some performance problems, but they didn’t seem serious and I considered that an acceptable trade-off for features.

Two weeks into Powerline, I still felt the ugly spots that I pointed out:

  • High prompt generation time
  • Unhandled Ctrl+c
  • argparse needs to be installed for Python older than 2.7

Unfortunately I did find more bad news.

Read more…

Best Sorting Algorithm

Today while doing some reading I came across some comparison of quicksort and merge sort. Then a question struck me: what is the “best” sorting algorithm? I know I had thought of that question time and again, but I have never got down to figure it out. Well, until today.

Wikipedia has a table comparing a bunch of algorithms, that can be sorted by each property (best case, average case, worst case, memory usage and stability). However, I find that a bit of work is needed to figure out the “best”.

Read more…

Powerline: Power-up for Your Terminal

Update: Powerline Revisited

A while ago I came across Powerline for Vim, which is a plugin that shows a pretty status line in Vim. Needless to say, the default status line is awful, and I am too lazy to set up my own status line. Even if I did, my status line would probably not look as good as this. I grabbed vim-powerline feeling thankful, like every time I grab a Vim plugin.

I did notice, however, that Powerline for Vim has a big deprecation warning in the home page, pointing to Powerline as the replacement. Unfortunately, the new Powerline required Python 2.7, and I’d need to install something system-wide using Pip. Meh, that’s against my idea of having per-user configurations. Users should be able to configure their applications without having to obtain administrative access.

Recently, having some free time, I decided to hack Powerline eliminate the need to install it system-wide.

Read more…

Good Laziness, Bad Laziness

People say that it’s good for a sysadmin to be lazy. Fair enough, a lazy sysadmin has more incentive to automate things. The same can be said about programmers, or IT workers in general. After a while everyone starts to go around saying that ey is proud to be a lazy person. Employers start to look at laziness as a desirable trait.

Read more…

Checking for Multiple URLs in Nagios

The default HTTP check in Nagios only checks for one URL, which is the IP address of the host. In a world where everyone is using name-based virtual hosts this is not very useful. Moreover, in some cases you may need to check different URLs of the same site to ensure that it’s working. This post will show you how to do that.

Read more…

Choosing an Opensource License

First of all I’m not a lawyer :) I am merely recording how I have chosen the Mozilla Public License (MPL) as my favorite opensource license.1

  1. This post was recovered from an [ snapshot][10] of my old blog 

Read more…

File sharing with Python's built-in HTTP server

Every once in a while you need to copy files from one computer to another. Across different operating systems, a sneakernet (read: copying files using a USB flash drive) seems to be the best option because most (if not all) computers can handle a USB. However, the process may become cumbersome because:1

  1. This post was recovered from an [ snapshot][5] of my 

Read more…