For a while I have been working on different elixir projects each with their own set of dependencies both on erlang and elixir.

Switching between is made simple using evm and kiex.
Evm – Erlang version manager is used to switch between the different versions of Erlang.
Kiex – Elixir version manager is used to switch between the different versions of Elixir.

Having these tools installed on the computer saves a bunch of time installing erlang & elixir.But remembering to switch between them for each project was difficult to remember.So the quick and naive way to solve this would be to use a .er file inside the project directory.This file would be sourced into the shell.

evm use OTP_18.1  # Sets the erlang version to 18.1
kiex use 1.2.5  # Sets the elixir version to 1.2.5

Another quick tip evm doesnt install erlang with SSL.To install it run the following.OpenSSL is installed on the system using Homebrew.If you are using the default openssl, change the directory.

evm install OTP_18.1 --with-ssl=/usr/local/opt/openssl


With some zsh magic now the shell will switch the version of erlang and elixir.

function set_erlang_version() {
   if [ -f .er ]; then
     source .er
chpwd_functions=(${chpwd_functions[@]} "set_erlang_version")


When writing ruby programs we usually write decorators to extend the methods of a particular object.Using them as form objects is one of the most common uses of a decorator.Ruby makes it simple and easy to create a decorator for a ruby object.

class StuffDecorator
  def initialize(og)
    @og = og
  def stuff

Now we can call the stuff method and it will easily return the class of the original object.

While working on an API backend I came across roar.Its a ruby library that allows you to add methods to your ruby object without breaking a sweat.

Here’s an example from the docs

require 'roar/decorator'
class Song
  include ActiveModel::Model
  attr_accessor :title

class SongRepresenter < Roar::Decorator
  include Roar::JSON

  property :title

song = "Medicine Balls") #=> {"title":"Medicine Balls"}

As you can see the property method calls the original object and returns the response.The best part is now you can get the json serialized version of the object.

If you want to add a custom method you can easily add a method or even override and existing one.

class SongRepresenter < Roar::Decorator
  include Roar::JSON

  def more
  property :title
  property :more, exec_context: :decorator

To make things better Roar allows you to serialize your decorator to JSON-API, XML, or even HAL.

All you have to do is include it in the decorator

class SongRepresenter < Roar::Decorator
  include Roar::JSON
  include Roar::XML

  property :title

song = "Medicine Balls") #=> "\n  test\n" 


Whenever we think about integrating sms in our application, the only company that comes to comes to is twilio. Twilio is a really good service however they are relatively expensive to their competitors especially if you know where your target audience is from.

In my case I was working for startup in Spain which operated in the Spain/Portugal region.For a while we were using twilio, but soon the number of sms we were sending grow to huge amount and we were spending a significant amount of money on it.

We came across another provider .Compared to Twilio it wasnt a very popular provider but its pricing was much better.We gave this a provider a try and tested sending SMS through them.Their delivery rate was pretty high and we decided to switch to them.We came across another issue, they didnt have a ruby client so I wrote a quick one and was ready to use it production.

We are now using the service in production for 2 months and we have had no issue so far.More over we reduced the cost of our sms by more than 3 times.

The library is available at

Last month I released a plugin for fog, a ruby gem that helps you manage servers on different cloud providers.

Cloudatcost is one of those unique providers where you can get a server for lifetime so basically you will don’t have to worry about paying for the machine every month.However the ui to create the virtual machine is extremely horrible.But then I came across their api. The noticed you can set the ram capacity for each machine through it.This is unlike most other providers who have a fixed size for the virtual machine.

So here is how i used fog-cloudatcost to setup multiple vpn servers.

require 'fog'

cac ={
  :provider  => 'CloudAtCost',
  :email     => '[email protected]',         # Your email address
  :api_key   => 'poiuweoruwoeiuroiwuer', # your API Token   
# Then we get the OS templates available

cac.templates.each do |image|
  puts image.detail

server = cac.servers.create :cpu => 'foobar', # 1, 2, 4 
                            :ram  => 1024, # multiple of 4 min 512
                            :storage => 10, # 10G
                            :template_id => 75 #Template id


Lately there are many services which track open email, like sidekick from hubspot.The way they work is very straight forward.Any time you open an email sent using sidekick it loads a unique transparent image from sidekick’s server thereby letting sidekick know that you have opened the email.This is not a problem if you are using unibox, a mail application that doesn’t open images automatically.But Gmail on the other hand loads all the images

Gmail had added a new feature couple of years ago, where it would cache images that are sent in bulk/mass email campaign, making the request anonymous (since google is making the request to the server).However many of these service now generate unique urls for these images.

So the only way to stop the tracking is to stop automatic loading of images.Luckily gmail has the option to disable image

To turn off image loading

  1. Click on the settings/cog icon on the right hand corner of gmail.
  2. Scroll down until you see the images section.Then click on Ask before displaying external images.

2015 was year of docker.I too was very skeptical of using docker for production.But coming to the end of the year, my views have changed on it drastically.This change was mostly due to the improvements in the developer workflow and maturation of tools like docker-compose(Formerly fig).

My three major concerns with docker were

  • How do I store persistent data essential in cases like running a database or image datastore.
  • Deployment of containers.
  • Running development environment like guard which listens for file changes and runs tasks like tests / code linting.

The first two of my concerns were resolved, but the last one still lingers.This issue is mostly due to the way docker is setup,during development I run docker using boot2docker since I work on a mac.Guard is a really essential tool while developing rails backends.Since it runs your tests whenever your code changes.This provides rapid feedback and helps to get into the RED GREEN RED code flow.However docker doesnt push the file changes trigger back to guard,rendering it useless.

I would like to end this post on a high note.The Docker community is growing and there are lot of changes to come to docker.

This is the first blog post from the Vim a day series.

The post is about the plugin ctrlP which is available here.This plugin is really useful since it lets you jump between files really quickly.

If you are using Vundle, its really easy to install.

Plugin 'kien/ctrlp.vim'

Now typing control + p does a quick fuzzy search in the current directory.Some of the quick shortcuts that I came across.

<c-t> Open the file in a new tab

<c-v>Open the file as vertical split

<c-x>Open the file as horizontal split


Lastly there is an essential configuration that could really speed up the fuzzy search

let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']

This ignores the files in .git folder and the .gitignore file.

Today I upgraded one of my old macs with an SSD.The SSD is freaking fast.But since the SSD was less than half the size of the existing HDD, I thought it would be good idea to move the docker host machine to the HDD instead of the SSD

Doing this was pretty simple.

First make sure the virtual machine was switched off.Then click on setting and then on the storage button which is the 3rd from the left.


Select the disk.vmdk and click on the floppy icon with the minus button.For those who dont know what a floppy is click here.Then click ok to save it.

Next open the following path in finder.  ~/.docker/machine/machines/default

Next copy the disk.vmdk drive to the HDD.

Once it is copied you can delete it from this folder.

Now we need to connect the Virtual drive back to the virtual machine.

Then click on File and select Virtual Media Manager.


Then click on the remove button from the virtual drive.If you dont follow this setup virtualbox will not allow you to connect the drive to the virtual machine.


Now you are ready to connect the virtual drive to the virtual machine.Click on the setting button for the virtual machine.Select storage and click on the plus hdd button and select the virtual drive.


Now the kitematic will use the same virtual machine and it will not notice a difference.

Recently I bought an old mac from my friend.This mac is pretty old, it has two GFX cards one integrated and one discrete.Switching the cards was really important since the machine would heat up while using the dedicated GPU.

I found this tool online on tool lets me easily switch the GPU using a statusbar application.