Using Folding@home

Folding@home is a software that relies on volunteers to run a distributed computation. To offer your idle CPU time, go to

Start folding

Choose your platform and download the “client” and “all” version. For Ubuntu, I got:

  • fahclient_7.5.1_amd64.deb
  • fahcontrol_7.5.1-1_all.deb

You can install them graphically. The second one installs an GUI application that shows up in the applications:

Screenshot from 2019-09-19 16-02-12

The first one installs a binary that can be executed from the command line FAHClient.


Coloring emacs active pane

When working using multi-panes within emacs, I often lose track of which pane my cursor is on.

There’s a very easy way to customize emacs to color panes differently based on whether they are active:


brew · emacs

Fixing emacs install path

I’ve recently switched from macports to brew. Things that were previously installed using macports were not working properly. For example emacs,

$brew list emacs

Returned the following:

/usr/local/Cellar/emacs/24.4/libexec/emacs/ (5 files)
/usr/local/Cellar/emacs/24.4/share/emacs/ (3822 files)
/usr/local/Cellar/emacs/24.4/share/icons/ (7 files)
/usr/local/Cellar/emacs/24.4/share/info/ (62 files)
/usr/local/Cellar/emacs/24.4/share/man/ (5 files)
/usr/local/Cellar/emacs/24.4/var/games/ (2 files)

But emacs, linked to /usr/local/bin/emacs was not linked to /usr/local/Cellar/emacs/24.4/bin/emacs

The fix was running

$brew link emacs

But before that I had to fix permissions to /usr/local/share/emacs which was set by macports: http://stackoverflow.com/questions/16844826/error-when-trying-to-brew-link-autoconf

brew · github · jekyll · ruby

[Ruby] Fixing: “Cannot load such file — hitimes/hitimes” when installing jekyll

I was getting the above error and the only page I could find was https://github.com/copiousfreetime/hitimes/issues/17 which doesn’t look related.

Context: I was trying to follow [1] and run jekyll on my local machine. When running bundle exec jekyll serve I got a stacktrace with the message:

Cannot load such file — hitimes/hitimes

I’m on a MacOS ans installed ruby using brew. The problem is that I had a native ruby installation and also remains from a previous mac port install. The fix was quite simple. First, how I got to a messed up stage:

I had a version of ruby running, but even when installed the newest version using brew, the versions were not matching:

ruby -v

Then I decided to override the PATH variable to find the brew installation first. For that we need to know where that is located:

$brew ls ruby

I also n00b’ed and hard-coded the /usr/local/Cellar/ruby/2.1.5/bin/ in the PATH env variable. But by default, brew will create a soft link to


But my directories were messed up (maybe because I was using macports before) and so the link was not created. To fix that, I had to run:

brew link --overwrite ruby

After fixing the symlink, I updated my path to include /usr/local/opt and this fixed the issue.


[1] https://help.github.com/articles/using-jekyll-with-pages/
[2] http://stackoverflow.com/questions/6482738/installing-ruby-gems-not-working-with-home-brew


Mercurial Templating

It’s possible to customize how the log output looks like using hg.
We can use inline templates as in:

hg log --template "{rev}"

{rev} is called a “keyword” and it gets replaced by the actual value when we do hg log. The list of keywords can be seen here.

Alternatively we can define our style in a separate file, e.g. ~/.hg/mytemplate.style:

changeset = 'changeset: {rev}:{node|short}'

We specify the style using --style=/home/unixname/.hg/mytemplate.style or setting the default style in .hgrc:


Other settings


We can change the font-colors of the text by using ANSI escape codes

Basically we specify \x1B[3<i>m where <i> is a number from 0 to 7 (see the wikipedia page for the color mapping). And \x1B[0m resets the color.

Files in multiple lines

We can add the following line that configures the formatting of a file entry (when using the {files} keyword)

file = ' {file}\n'

Date in my timezone

We can use



[1] http://hgbook.red-bean.com/read/customizing-the-output-of-mercurial.html
[2] http://stackoverflow.com/questions/8643612/how-to-make-hg-log-verbose-show-files-on-multiple-lines
[3] http://www.selenic.com/hg/help/templates


2048 CLI in python

I’ve decided to code a simple CLI version of the 2048 game in python:


Some details of the implementation:

* I’ve handled only the “up” move. For the others I do a rotation of either 90, 180 or 270 degrees the matrix representing the board.
* The core of the algorithm is apply “gravity”, perform the merge with adjacent element with same number and then apply the “gravity” again because my merge function can leave empty spaces.


[bash] Move and change directory (mv & cd)

In many cases when I move one or more files to a directory I want to change to that directory afterwards. I did a little search and found this discussion, which resulted in the following bash script function:

function mvcd () 
     num_of_files=$(($# - 1))
     for i in $(eval echo {1..$num_of_files})
         eval mv \${$i} \${$#}
     eval cd \${$#}


mkdir c
touch a.txt b.txt
mvcd a.txt b.txt c