Falsehoods programmers believe about Unix time

A while back I blogged a collection of “Falsehoods programmers believe about …“. One of those things was time. Today I came across a nice addition to that – “Falsehoods programmers believe about Unix time“.

These three facts all seem eminently sensible and reasonable, right?
1. Unix time is the number of seconds since 1 January 1970 00:00:00 UTC
2. If I wait exactly one second, Unix time advances by exactly one second
3. Unix time can never go backwards
False, false, false.

All three of these are false and for the same reason – leap seconds. The article provides a nice and easy explanation of how and why that happens.

Container misconceptions

Ricard Bejarano points out a few container misconceptions. I particular like the bit about Swarm as a better option than Kubernetes for individual projects and small setups (1-2 nodes):

Swarm is Docker, Inc.’s orchestrator. It started development five years ago. It’s built into the Docker Engine, which makes it the same to run it on development machines as in production servers.
In my opinion, it is much less powerful than Kubernetes, and I would vote against using it in a business environment.
That said, I’m a happy admin of a single-node Swarm running all of my personal services at home. But that’s it. I wouldn’t use it for anything with more than 1-2 nodes, but for those applications, I feel is the right tool for the job.

40x speed up of ls on large dirs

If you ever tried listing a directory with a lot (10,000+) of files in it, I’m sure you know how annoyingly slow ‘ls’ can be. Turns out there is a simple way to make it better. Have a look at the “When setting an environment variable gives you a 40x speedup” blog post.

Or just do the following:

export LS_COLORS='ex=00:su=00:sg=00:ca=00:'

This will disable colors on the executable files, setuid/setgid bits, and capabilities.

Debugging in Vim

Personally, I’m not a frequent user of debuggers. Most of the projects and code that I am involved with is easily debugged with good old “die(‘here’)”. But if you are looking for some help on how to use Vim with a debugger, have a look at the “Debugging in Vim” blog post.