Sunday, June 25, 2017

Hasura Internship - x.x The Break

From May 13 to May 28 saw a lot many things happening.

  • The company where I worked decided to let me and my team go. So now I'm left with the slow and agonizing task of dusting off my resume and that old Q.A book.
  • First things first, I decided to remake my resume. Done.
  • After countless days of running around we scored a place. Unfortunately the boys and gals at the new place played with the bleeding edge when it came to their stack. And we were dinosaurs. So I had to pause what I was doing till then and get a hang for ES6, MongoDB and Angular
  • I notified the Operations Head at the internship about the delay and he was more than understanding in this regard.
  • In order to get a grip of things I wanted to do a project with the things I was learning. So I decided to do the Internship App on this new stack, save for using angular(still too alien).
  • A video on the pre-alpha can be found on youtube. The source will be pushed on to github, when it's ready.
Currently I'm rushing to get back on track. The date is 26 June today, and I'm hoping to finish this puppy by 29 June.

Hasura Internship - 2.3 The pain of local development

The Hasura platform is awesome. The whole purpose of the internship was to get us to build stuff using Hasura APIs and what not. I gently grazed over the hasura docs, and for me personally it feels like there's no more fun left in coding out what I want. I may not be the greatest programmer, but I do take fun and joy in building the stuff I want, the way I want. It's one of the reasons why I stare at the screen all day. Ranting aside, lets setup the Hasura platform on our local machine.

Lets do this

The local dev setup relies on setting up pre-configured virtual machines which are controlled by a tool called kubernetes.
  1. Enable Hardware virtualization if we have a UEFI machine 
  2. Install virtualbox : sudo apt install virtualbox
  3. Get kubectl (linux link) and move it to /usr/local/bin or our preferred location.
  4. Clone the local-dev repo. The repo changed quite a lot when I had set it up (it's now just one README now).
  5. Read the README in the url mentioned above.  After executing a line that goes kubectl create -f platform-init.yaml , a ~2GB download will start. Be patient till it finishes.
  6. If we have anything running on port 80 (ie local apache or nginx), stop the service before launching the local instance of hasura platform. A netstat -nptl wil show all tcp and udp ports in use, in our linux system.
  7. Free atleast 4GB of RAM to have a smooth experience with the platform.
  8. Its a pain to always type in 2 or 3 commands to get something up and running. So make scripts to get things rolling
$ cat ~/bin/


echo "starting minikube ... "
minikube start --kubernetes-version v1.6.3
echo "minikube running :)"

GW_IP=`minikube ip`

sudo ssh -N -o UserKnownHostsFile=/dev/null -L 80:$GW_IP:80 -L 2022:$GW_IP:2022 docker@$GW_IP

Run the above script to start hasura and the below one to stop it.

$ cat ~/bin/


minikube stop

Log Date : May 10 - 20

Wednesday, June 14, 2017

Hasura Internship - 2.2 The wonders of git

Git is a magnificent version control tool. What does that mean? 😅

Let's do a tiny insignificant project to get the basics out of the way.

Start a project

$ mkdir ~/Projects/chicken_soup
$ cd ~/Projects/chicken_soup
$ touch recipe.txt

This project will contain only a text file, having a silly recipe for chicken soup 😎
With this, we have a base project structure in place.

Asking git to track this project

$ git init

When we do this, we see that there is a .git folder magically appearing on our project folder. This is where git stores all relevant information to file changes in our project. If we have not configured git, now is the best time.

$ git config --global "superman"
$ git config --global ""

Let's write something to our recipe file.

$ echo "1. Get a chicken gutted." > recipe.txt

We want git to know that recipe.txt is a file it should track within our project. So we do

$ git add recipe.txt # or git add . 
# the alternative will keep track of all files in the folder

Our first commit

$ git commit -m "My first commit"

This tells git that we want to update our additions and git should consider this as a check point. Each commit will be a separate checkpoint in our project. The -m is simply a way to pass a message along with our commit, so that we can understand the commit logs later.

$ git log

Will show us that our change has indeed been tracked. That's it 😉

Let's do that again

$ echo "2. Apply masala over it." >> recipe.txt
$ git add recipe.txt
$ git commit -m "applying masala"

Now if we do a git log, we can see 2 entries. Do note the weird number strings, like 2edfr5t0fd649d774ca3fb77614bde9a62axsd9 in my case. Also check the order in which they appear. The one at the top, is our latest commit.

Yikes, I screwed up. Abort

If I want to reset the file to the first commit, we can do that

$ git reset --hard bd959d6a0fd649d774ca3fb77614bde9a61f64f9   

Now if we look at the contents of recipe.txt, we see just the one line. Of course this isn't earth shattering. Try adding a few files and add content to these files. This is where git shows its magic.

Onto the internet

Github is a service on top of git that takes our projects and gives it an online presence. After we register for a github account, we can add our chicken soup project to it.

The following is our projects URL after we go through the initial stages of adding a new project to our github account.

From our project folder in our machine, do

$ git remote add origin
$ git push -u origin master

This will set our projects repo url and push our code to github. If we go to in a browser, we can see our project. 

Let's add some more changes

$ echo "100. Eat chicken soup." >> recipe.txt
$ git add recipe.txt
$ git commit -m "Final step added"

We push these changes to github

$ git push -u origin master

So, later we're on our friend's machine and we want to show what we made. Assuming that our friend has git installed, a

$ git clone

will download the entire project to the friends machine.


This was just a rudimentary intro. An awesome book on git can be found here

Tuesday, June 13, 2017

Hasura Internship - 2.1 Setup dev environment

The following are the things I need to get some work done on making the app.

Node JS

I'm running my dev environment on Ubuntu, to install node on it, execute the following commands on the terminal

$ curl -sL | sudo -E bash -
$ sudo apt-get install -y nodejs

The node js website has detailed info for installing node on the Operating System of choice for the user.


Git is our version control program. It's basically a program that keeps track of changes to files in our project. 

If I screw up on a perfectly working project and I want to revert the project to a stage before the screw-up, I can do that with git.

$ sudo apt-get install git

That would install git onto my ubuntu machine. A quickstart on git can be found here. To get our feet really wet, there's a book called Pro-Git.

Sublime Text

This is my preferred text editor for code. Even though my inner vim-genin is cursing me for this choice, time is of the essence in the internship. 

$ wget -qO - | sudo apt-key add -

 The above would make our system trust packages from sublimeHQ.

$ echo "deb apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

This line adds the stable repo url for sublime text.

$ sudo apt-get update
$ sudo apt-get install sublime-text

Finally update the repo cache and install sublime text.

The Shell

Over the years, I've grown quite fond of a shell called zsh. Its immense completion system is really a priced feature for me. Luckily, there is a community maintained project called oh-my-zsh that gives me a good modularized zsh configuration that I can extend with plugins

$ sudo apt-get install zsh
$ sh -c "$(curl -fsSL"

Log Date : May 1-10

Hasura Internship - 1.2 Prototyping


The entire app should have a max of 3 pages.
  • Must have a provision to add a new family, add a new member to the family and finally make edits.
  • Member images and family image can be added and edited.

Prototype (TL;DR)

The three pages are  
  1. search - the search display mock up.
  2. one - detailed view of a member's family.
  3. add - to add a new family and then members to it.  
A pdf document of all the prototypes of all three pages can be found here. Credits to for the awesome tools to make the prototype.

A live view of the pages are hosted temporarily on my personal site.

The pages use bootstrap, just because I can't do responsive design.

The project can be tracked on its github page.

Log Date : May 1-10 

Monday, June 12, 2017

Hasura Internship - 1.1 App Idea

By the end of January, something amazing happened. I enrolled in an online mooc called IMAD from the folks at Hasura and IIT-M. And by the grace of the force, I was able to clear it and make a small webapp in the process. As part of this, Hasura selected a few students(almost 400 of us), for an internship, where we would have to make an app using the hasura platform

The Internship

The following are the guide lines

  • Strictly use the Hasura platform.
  • The app should contain only three screens, excluding the login page.
  • NodeJS and Python are favored, but are not the only languages for back-end coding. 
  • The app building should take less than 7 weeks, with the 8th week being left for getting feedback and improvements.
  • The interns should blog about their progress somewhere (hence this blog post).

App Idea

I am not a very religious person, but I do occasionally go to my chruch. And when I do, I always meet someone, who I have no idea about. There is a directory for our chruch members, but that book is 250 pages thick and weighs a ton. So, there has been a talk whether we can take that info and make it online (Carrying a 24 inch smartphone is considered normal).

So, it's settled, I'll build an online searchable directory for my parish. 
I'll have to do some mad research if I wanna squeeze everything down to three pages.

We'll see how it goes.

Log Date : May 1-10

Friday, April 29, 2016

Installing mariadb in ubuntu 14.04 and setting up a 2 node galera cluster

Getting ready

Let's update our apt cache with the mariadb apt repo, so that we can get the latest and greatest version.
Add the following two lines to /etc/apt/sources.list

deb trusty main
deb-src trusty main

Now perform an update of the repo cache in our system

sudo apt-get update

And then install mariadb with galera and rsync

sudo apt-get install mariadb-server galera-3 rsync

Installation is done.

Configuring mariadb with galera

I'm going to use 2 nodes here, (master_node) and (slave node). 

In our master_node I'm going to create a file called  cluster.cnf  in   /etc/mysql/conf.d  (Very important that the file name ends with  .cnf )  and put in the following contents.


wsrep_provider_options="pc.weight=3" #tells this server is very important

In our slave_node I'm going to create the same file, in the same location  and put in the following contents.

wsrep_cluster_name="cluster_test" # same name as in primary server

We're done configuring. Now in the master_node (primary server) run 

sudo service mysql stop
sudo service mysql start --wsrep-new-cluster

Check if we have successfully started a node in our cluster by running this from our terminal shell

mysql -u root -p -e 'SELECT VARIABLE_VALUE as "cluster size" FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME="wsrep_cluster_size"'

It should return 1. If so, we're good.

We next bring up our slave_node (secondary server). Run these from our second node 

sudo service mysql stop
sudo service mysql start # only use --wsrep-new-cluster in primary server

That's it !. Create a database from any one of the nodes and it'll be reflected on the other.

One more thing

Copy the file /etc/mysql/debian.cnf from the primary server into the secondary server (replace the one it has).


Saturday, November 22, 2014

Solarized dwm + debian

This article is a small post-it to get the desktop of my dreams installed on my machine :)

1. Installing and configuring dwm

Installing dwm from the debian repos is easy but, inorder to customize it we need to compile it from source. First, I install the dependencies

sudo apt-get install libc6 libx11-6 libxinerama1 make gcc suckless-tools xfonts-terminus

dwm by default uses the terminus font and I like it too. Now for the fun part

sudo aptitude build-dep dwm

Now we make a directory to put the source code in, and play around :P

mkdir ~/build
cd ~/build/
apt-get source dwm
cd dwm-6./

Next we edit the config.def.h in the directory and save it as config.h

cp config.def.h config.h
vim config.h

I'm only interested in changing the colors and the font used for the time being so in the config.h file I change ::

static const char font[]            = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#cccccc";
static const char normbgcolor[]     = "#cccccc";
static const char normfgcolor[]     = "#000000";
static const char selbordercolor[]  = "#0066ff";
static const char selbgcolor[]      = "#0066ff";
static const char selfgcolor[]      = "#ffffff";

to this ::

static const char font[]            ="-artwiz-snap-normal-*-*-*-*-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#073642";
static const char normbgcolor[]     = "#002B36";
static const char normfgcolor[]     = "#839496";
static const char selbordercolor[]  = "#586E75";
static const char selbgcolor[]      = "#073642";
static const char selfgcolor[]      = "#839496";

Use xfontsel to see what all fonts we can use. I use the snap font from artwiz package. If you use another terminal emulator change the *termcmd[] command to this ::

static const char *termcmd[]  = { "urxvtc", NULL };

I have the urxvt daemon running in the background when I launch dwm, so the urxvtc.

After this is done, save and exit. From the directory issue 

sudo make clean install

That's it. Now Launch dwm form your $HOME/.xinitrc . If you dont have one follow me

vim .xinitrc

It's content should be something like

exec dwm

Give it executable permissions with chmod +x .xinitrc and we're all set with dwm part. 

For the time being my dwm setup is this ::


To get the date and battery status on the dwm statusbar before the exec dwm line in .xinitrc add 

while xsetroot -name "Batt:$(acpi | awk '{ print $4 }' | tr -d ',')  $(date +%R)"

Save the file and we're done.

Friday, October 3, 2014

Stepping into freeBSD


FreeBSD unlike Linux is a pure UNIX OS(I really don't see the difference, that's just me). Any how this writing is to specify the stuff I did to get FreeBSD up and running on my Dell Inspiron 630m. 

The machine has a centrino processor and has only 512 MB of RAM, so my choice of software has to be lightweight and specific. For these reasons compiling from ports seem to be the best option. Using the handbook, I was able to get i386 version of FreeBSD(usb image) installed on the machine.  Inorder to make a bootable usb stick with windows I used this.

Basic stuff 

User Management:

I had setup a normal user account during the initial setup. On my fresh install the first thing I do is to add my user to the wheel group. If I have to issue an "su" I need to be in the wheel group. I do that with 

pw groupmod operator -m user_name

And we are done. If we didn't create a user at the initial setup then issue the following

pw user add -n user_name -c "Full_user_name" -g wheel -m -h 0

Btw, I dont need to mention this, but the above need to be executed as root.

Lets setup the system:

I did mention that I need the system to be light on resources, so Im going to compile using ports. By doing so, I get to disable options of software that I'm not going to use. Enough chit chat, lets start.

1.Getting ports

As root

portsnap fetch extract update

I watched an entire movie while this was completing. Based on ones machine, this can take a while. But totally worth the effort.

Now I'll install a port management tool called portmaster. I do that like this

cd /usr/ports/ports-mgmt/portmaster/ && make install clean

When that completes we need to configure it a bit. So I take a sample config file provided with the port and use that. I do that like so

cp /usr/local/etc/portmaster.rc.sample /usr/local/etc/portmaster.rc

ee /usr/local/etc/portmaster.rc

ee is freebsd's default text editor. Add the following into it

# Always delete stale distfiles without prompting (-d)


# Be verbose (-v)


# Install packages for build-only dependencies (--packages-build)


# Delete build-only dependencies when finished (--delete-build-only)


#Suppress the build confirmation message (--no-confirm)


Save and exit out from ee. Now we'll use portmaster to compile our ports.

Below are some commands I find useful.

update all ports:

   portmaster -a
      portmaster -af
search for updates and list all installed ports by category:
   portmaster -L
   portmaster -L | grep "New version available:"
clean stale distfiles:

   portmaster --clean-distfiles
   with out promt:
      portmaster --clean-distfiles-all
uninstall the port and it's dependencies:
   portmaster -e target_port

rebuild the specified port, and all ports that depend on it:
   portmaster -r target_port

2. Setting up X

portmaster x11-servers/xorg-server

portmaster x11-drivers/xorg-drivers

portmaster x11/xinit

portmaster x11/xauth

portmaster x11-fonts/xorg-fonts

portmaster x11-fonts/webfonts

 The above will install a minimal Xorg server and a couple of drivers for keyboard and mouse. Disable hal in each installation of a port. Now we configure X

Xorg -configure

cp /root/ /etc/X11/xorg.conf

To configure mouse

echo "moused_port=\"/dev/psm0\"" >> /etc/rc.conf

echo "moused_enable=\"YES\"" >> /etc/rc.conf

3.Window Manager

I love #! linux and openbox, So i'll use openbox on this machine.

portmaster x11-wm/openbox

mkdir ~/.config

mkdir ~/.config/openbox

cp /usr/local/etc/xdg/openbox/menu.xml ~/.config/openbox/menu.xml

cp /usr/local/etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml

touch ~/.config/openbox/ && chmod +x ~/.config/openbox/

echo "#!/bin/sh" >> ~/.config/openbox/

echo "exec openbox-session" >> ~/.xinitrc

I need a panel so,

portmaster deskutils/pypanel

I'll want it to autostart with openbox so,

echo "(sleep 2 && pypanel) &" >> ~/.config/openbox/

4.Automounting USB drives

portmaster sysutils/automount

Add automounter_enable="YES" to /etc/rc.conf and we are set.

With that my freeBSD box is setup. More writings will follow. Thank you to taz from the forums. I just took his guide and replicated it here.


Thursday, September 4, 2014

Getting started with OpenBSD

After a long time being a linux user, I decided to try BSD. And because the transition was hard, I'll post the stuff (what I did) here for future ref.

Sunday, June 15, 2014

A fresh start

Why the change ?

I'm not a much of a great blogger, but I do wanna make myself turn back and see what all I have done in the past. From now on, there will be regular updates to the blog. I have been rusting for a while. Time to dust off and move on. Lot of personal crap bogged me down, but i'm now ready to kick butt.

First move

I've decided to jump from GNU\Linux to freeBSD, mainly because of curiosity as I wanted to try something different. Things can go bork, but hey that's the fun part. This is the thing that motivated me:

Second move

Learning something new. I know a couple of languages but not any to the point where I can design anything I want. So, starting today I'm visiting my roots to C and fall in love with code.

Last thing

My PC (eleanor) met a tragic end when a thunder storm took out her mother board. So repairs and other things are to follow.

~Live long and prosper.

Friday, December 20, 2013

Lightweight debian desktop

Why am I doing this, when there are already like a billion articles on the internet on how to do this?, Its because I can :D. In this article I'll do a debian net-install and over that I'll add my desktop.

1. Getting the install media
                                    Go to the "Official netinst images for the stable release" section of the debian downloads page and download the net-install CD-image. I chose torrent, and at the time of writing the stable version I've downloaded is debian-7.2.0-i386-netinst.iso . My laptop is old, but it has a usb port... and since its evil not to use a usb port I'll make a bootable usb stick for my installation.

Download unetbootin and launch it. Choose "Disk Image" and then browse for our debian iso. Ahem!! did you plug in your thumb drive :D . Dont change any of the other settings, now click on OK. Wait for it to finish and now you have a bootable usb drive.

2. Doing the install
                                  Boot the PC or laptop from the  usb stick. On the first screen Press Enter on "Install". And now we'll be presented with the debian installer. Choose your keyboard layout. (the internet connection should be up). The next screen you’re likely to see is choosing a hostname. Chances are, you can make up whatever you want. Now it’s time to pick a local mirror. After choosing your country, you’ll be asked which mirror to use.Username and password?? You'll be prompted to give a root user password, leave it blank, press Enter each time. Then the normal user we are to create will be automatically given sudo privilleges. Next comes a partitioning screen, I'll go ahead and use the entire disk. Now on the screen where we are to choose our software see to it that only "Standard system utilities" is only checked. Also if you're doing this on a laptop like i am check "Laptop" box also. Now sit back and enjoy the screen if red and blue progress bars. Now choose where to install grub. Choose MBR, which is the safest choice. And thats it, we have our debian net-install on our machines drive.


Of late, I've been playing with a debian net-install. I wanted to do a desktop with minimum footprint. This is what I came up with.

new deb

Window manager is jwm, fonts are terminus and snap.