Wunderlist to Taskwarrior


Wunderlist to Taskwarrior is an application that fetches your tasks from Wunderlist and inserts them into Taskwarrior. It can be regularly ran by the operating system to keep Taskwarrior up-to-date.

Why I Made This

As I cannot update Taskwarrior when I am not near one of my computers I needed a way to update Taskwarrior while on the road. The solution I found uses Wunderlist as an intermediate. I already used Wunderlist for simple lists such as the weekly groceries but I greatly prefer Taskwarrior over it, so I still use Taskwarrior when I am at my computer.

Relevant Features

  • Selective Synchronization. Lists starting with “!” are never synchronized.
  • Data Safety. All communication is done via HTTPS.
  • Persistence. SQLite is used to keep track of what has been synchronized.

I had to decide between a continuous process which would update Taskwarrior or a utility application that would be scheduled to run regularly. I opted for the latter as the application initialization and termination are not so expensive. Currently, I’ve been running it every minute on one of my computers.

The Code

Wunderlist to Taskwarrior was written in Haskell using Stack so it should be easy enough to get a build for your own computer.

This is the GitHub repository.

Minimum Window Substring


This is a post regarding the solution to a substring problem which follows a pattern that is quite common among substring problems: it is solvable with a pair of fast and slow iterators.

If this is not possible, we will return the empty string.

Problem Statement

Given two strings, S and T, find the minimum window in S which will contain all the characters in T (with their frequencies) in linear time.

S T Answer
"" "" ""
"" "A" ""
"A" "" ""
"A" "A" "A"
"A" "AB" "A"

C++ Solution

string minimum_window_substring(string s, string t) {
  if (t.empty()) {
    return "";
  // Frequency in the token.
  unordered_map<char, size_t> tf;
  for (char c : t) {
  // Frequency in the string.
  unordered_map<char, size_t> sf;
  // How many characters we have to match.
  const auto target = t.size();
  const auto n = s.size();
  size_t best_i = 0;
  const auto no_size = numeric_limits<size_t>::max();
  size_t best_size = no_size;
  size_t slow = 0;
  size_t fast = 0;
  size_t matched = 0;
  // Advance fast until we met the target.
  // Then shrink with slow until we no longer meet the conditions.
  // As this advances each pointer at most N times, this is O(n).
  while (slow < n && fast < n) {
    if (sf[s[fast]] <= tf[s[fast]]) {
    // Here, the range is [slow, fast).
    while (matched == target && slow < fast) {
      const size_t match_size = fast - slow;
      if (match_size < best_size) {
        best_i = slow;
        best_size = match_size;
      if (sf[s[slow]] < tf[s[slow]]) {
  if (best_size == no_size) {
    return "";
  return s.substr(best_i, best_size);

Hellish Bricks DevBlog 2

This is an update on what I have recently done to Hellish Bricks.

Progression Curves

The game got progression curves for running speed and initial jump speed.

Speed Curve

Jump Speed Curve

These are important so that the character evolves, creating more gameplay possibilities as the game progresses.

Colored Lights

I’ve also enabled lantern and ambient light commands so that the player can change the lantern and the ambient light colors during the game or during initialization, through the boot script.

Default Boot Script

# Set lantern to a light yellow.
lantern #EEEEBB
# Set ambient to a dark red.
ambient #443322

White and Colored Lights Comparison

White Lights

Colored Lights

Hellish Bricks DevBlog 1

This is the first of what may end up being a series of posts regarding the development of my closed-source game Hellish Bricks.

The game is heavily inspired on Devil Daggers (2016), but intends to focus on low-poly and minimalist graphics instead of retro ones.

Hellish Bricks is written using modern C++ and requires at least OpenGL 3.3 and just about 128 MiB of free memory for now.

I intend to write better and more visually appealing shaders in the future and start working on some fancier graphical effects, such as particles and shadows.

Gameplay Video

Playable Demo

You need at least Windows Vista to run the game and you may also need to download and install the Microsoft Visual C++ Redistributable for Visual Studio 2017 before being able to execute the game.

New versions of Wine are also able to run the abovementioned executable.

In the future I may release Linux, BSD and maybe even macOS demo builds.

Bitwise And of Range

Recently I had to solve a problem which asked you to determine the bitwise and of a range of nonnegative numbers. There is an obvious linear solution to this problem which simply computes the bitwise and of the range.

Bitwise and of [4, 10] = 4 & 5 & 6 & 7 & 8 & 9 & 10

However, after thinking about how the anding ends up “erasing” bits permanently I figured out the following logarithmic solution:

def bitwise_and_of_range(begin, end):
    if begin == end:
        return begin
        return bitwise_and_of_range(begin >> 1, end >> 1) << 1

Essentially, if you have at least two numbers in the range, the last bit will be zero, so you can compute the bitwise and of the prefixes and append a zero to the result (by shifting it to the left).