The first two statements of your BASH script should be…

The first statement is a Mac, GNU/Linux, and BSD portable way of finding the location of the bash interpreter. The second statement combines

    1. “set -e” which ensures that your script stops on first command failure. By default, when a command fails, BASH executes the next command. Looking at the logs, you might feel that the script executed successfully while some commands might have failed. Caveat: Be careful about applying it to existing scripts.
    2. “set -u” which ensures that your script exits on the first unset variable encountered. Otherwise, bash replaces the unset variables with empty default values.
    3. “set -o pipefail” which ensures that if any command in a set of piped commands failed, the overall exit status is the status of the failed command. Otherwise, the exit status is the status of the last command.

References:

  1. Unofficial Bash strict mode
  2. ExplainShell

Barcelona (Spain) in four days

Barcelona

  1. Public transport is good, get a Metro card with ten tickets, it can even be shared simultaneously.
  2. Beware of pickpockets.
  3. Credit card acceptance is high, but not 100%.
  4. Paella, a rice dish, is famous in Barcelona

Read More

A Punjabi (Gurmukhi) primer for native Hindi (Devanagari) speakers

Most native Hindi speakers like me are familiar with Punjabi vocabulary through Punjabi music. Out of curiosity, I decided to spend some time learning Gurmukhi. I was a bit taken aback by the fact that most articles and videos were aimed at teaching Punjabi (Gurmukhi) to English speakers. However, it is much easier to map Punjabi (Gurmukhi) to Hindi (Devanagari) letters for a native Hindi speaker, as almost all Gurmukhi letters map really well to the Devanagari counterparts. Here are my notes.

Read More

Madrid (Spain) in two days

Madrid, originally Myrit, was set up by Moors in about 700 AD, to fight against Catholic Spanish stronghold of Toledo which used to be the old capital of the Castile kingdom.

  1. Public transport is good, get a Metro card with ten tickets, it can even be shared simultaneously.
  2. Beware of pickpockets.
  3. Credit card acceptance is high, but not 100%.
  4. Churros + hot chocolate are famous in Madrid.
  5. The city has pedestrianized itself over time, so the city center is entirely car-free.

Read More

Keep your dotfiles bug-free with Continuous Integration

Update: As of April 2020, I have switched over to GitHub Actions. Travis CI has become buggy and flaky over time and I got tired of trying to keep the builds green. My GitHub action scripts can be seen here.

Just like many software engineers, I maintain my config files for GNU/Linux and Mac OS in a git repository. Given that, I wrote a fair bit of them in interpreted code, notably, Bash, it is a bit hard to ensure that it is bug-free. The other problem I face is that packages on homebrew, the Mac OS package manager becomes obsolete and gets deleted from time to time.

I added CI testing on Travis CI to prevent these breakages and to ensure that my dotfiles are always in good shape for installation. The great thing about Travis CI is that it is entirely free for open-source repositories even for testing on Mac OS containers.

Read More

Why not abolish employer-provided health insurance?

Car insurance in the United States is a system that more or less works well. You call up insurance agents representing different insurance companies with similar policies but the varying quality of service. Then you buy it based on how much insurance premium they charge and how good/bad quality of service you are willing to accept. If you have an expensive car or you are a reckless driver, you end up paying more. The less you use your insurance, the lower your premium becomes over time.

Read More

Rome (Italy) in three days

Rome has a rich history pertinent to western civilization. There are three different aspects of roaming in Rome, namely, architecture, history, and religion (Catholic – Christians). I was profoundly interested in history and to some extent, in architecture, and that influenced my itinerary.

Read More

Programmable Money and value capture

Money serves three purpose – unit of accounting, a medium of exchange, and a store of value. Cryptocurrencies have been compared to Programmable Money. Anything programmable requires an experimentation platform for iterations and improvement. Bitcoin seems to have won the “store of value” battle. Ethereum has the developer mindshare and is the preferred experimentation platform. Multiple cryptocurrencies are still fighting the battle to be the medium of exchange.

BTC dominance chart from CoinMarketCap

BTC dominance chart from CoinMarketCap

The amusing part is that every cryptocurrency startup envies Ethereum’s developer ecosystem and is trying to attract developers. But there isn’t any real value capture being the experimentation platform. A successful product has a high chance of leaving Ethereum and migrating users to its chain. The real battle, I believe, remains in becoming the medium of exchange, being the programmable Visa & Mastercard equivalent.

A day in Venice (Italy)

A day in Venice

Compared to Prague, Rome, Vienna, and Split, Venice is a tourist trap. The city is made up of a collection of 100+ islands. Bridges connect most of them, and you can walk throughout the city. All the public transport is using water buses called Vaporetto. A single trip costs 8 Euros. If you are planning to use Vaporetto, buy a 24-hour pass worth 20 Euro which covers unlimited trips on Vaporetto.

Read More

Circle CI vs Travis CI

I maintain a somewhat popular Android developer tool (adb-enhanced). The tool is written in Python, supporting both Python 2 and 3. Testing the tool requires both Python runtime as well a running Android emulator. I, initially, used Travis CI for setting up continuous testing of this tool. Later, I felt that Travis CI was too slow and when I came across Circle CI, I decided to give it a try. As of now, both Travis and Circle CI are used for testing. Here is what I learnedĀ from my experience.

Read More