Git : Delete remote tag

April 18th, 2014 § 0 comments § permalink

Here is how you can delete a git tag in the local and remote repo. It is pretty similar how we delete remote branch.

To delete tag locally use

git tag -d v1.0.0

To delete tag in the remote repo

git push origin :refs/tags/v1.0.0

Thats it.
Thank you.

HAML : Using variable in JavaScript block

February 10th, 2014 § 0 comments § permalink

While I was getting started with HAML templating, everything went fine until I need to use a HAML variable inside a JavaScript block. I hope you may familiar with JavaScript block in HAML like below.

  var a = 10;

But what if that variable a is a HAML variable and I need to use  inside the :javascript block? I had no idea how to do it, so went for some googling. The result yeilded was pretty amazing and easy. I just need to interpolate the variable as we do string interpolation in ruby.


That’s it you are done. Now you are using a HAML variable inside the :javascript block.

Pretty easy right?

Configure ace editor

February 10th, 2014 § 0 comments § permalink

While I was working on my latest side project, I though of using ace editor for syntax highlighting and code styling. But, configuring editor was bit confusing for me. There was a bunch of CDN links of ace editor available on the site, But didn’t have much information about which one I should use. I tried some of them but didn’t worked for me. At last after some googling, I got the below solution.

I started with defining a div for the editor.

<div id="editor"></div>

Now I need to add the ace editor script, the script worked for me is the one given below.

<script src= '//'></script>

At last need to configure the editor, as you needed

var editor = ace.edit("editor");

You can configure the editor as you need, I set the mode as json for my application. You set it as ruby, php, etc.. as you need.


Mongodb : Install on Ubuntu

December 12th, 2013 § 0 comments § permalink

As part of getting started to NoSQL DB’s I thought of trying out MongoDB.


Installation was quite easy. Here is how I installed mongoDB on your ubuntu.

sudo apt-key adv --keyserver hkp:// --recv 7F0CEB10
echo 'deb dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

Thats it, installation is over.

Start mongoDB

The mongoDB is setup with upstart, so you can start the service with the following command

sudo service mongodb start

Explore CLI

You can enter into mongoDB CLI to explore more, just type mongo in your terminal

mongoDB CLI

mongoDB CLI

Everything is fine. But when I do unclean shutdown sometimes, mongoDB service won’t start automatically. So after each unclean shutdown I need to do remove the lock file and start service manually.

sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb start

Happy exploring mongoDB.

Ubuntu : Add applications to system tray

October 21st, 2013 § 0 comments § permalink

In Ubuntu, by default system-tray won’t show newly installed apps like Xchat or Zeal. This post will walk you though “How to configure system tray to whitelist any application“.

Dconf Editor

We use dconf-editor to update the system-tray whitelist.


You can easily install it with apt-get.

sudo apt-get install dconf-tools

Run it.

You can either type dconf-editor on terminal or click on dash home and search for dconf-editor.


Dash home search

After opening dconf editor, Navigate to Desktop > Unity > Panel there you can find systray-whitelist.

Systray-whitelist before editing

Systray-whitelist before editing

Double click on the value and update to ['all'] or add your application name to the list.

Eg. Initially the value will be

['JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier', 'Jupiter']

After adding Xchat and Zeal, it become

['JavaEmbeddedFrame', 'Wine', 'scp-dbus-service', 'Update-notifier', 'Jupiter', 'Xchat', 'Zeal']

or if you are adding all,

Systray after adding all

Systray after adding all

You are done. Now just logout and login for changes to take effect. After that When you minimise Xchat or Zeal you can find their icon over system try.


Boot virtual box as headless

October 10th, 2013 § 0 comments § permalink

If you are running a ubuntu server on a VM, then I highly recommend you to boot VM as headless. Here I use Oracle VirtualBox as my VM.


The two advantanges I found are

  • Saves some amount of RAM.
  • Anyway I ssh to VM, then one less window opened.

Even before I came to know that I can run VM as headless, I usually boot the VM and keep the window minimized. Then I ssh to VM from my terminal, so I can easily copy and paste text to and fro VM.

How to boot as headless?

You can boot the VM as headless using the command

 vboxmanage startvm precise64 --type headless

and you can shutdown the VM by

vboxmanage controlvm precise64 poweroff

PHP : Add element in the beginning of an array

August 6th, 2013 § 0 comments § permalink

We can add an element in the beginning of an array using array_unshift method. Its quite easy and handy, But did you know that array_unshift will reindex you array? Thats what I like to discuss over this blog post.

Lets take the above php array as sample. I intentionally missed the indexes 3 and 4 to show array_unshift method will reindex your array.

See the Fifth is moved to 3rd index? This will happen only when the indexes are numeric.

So the easy way to append an element in the beginning of an array without reindexing is using “+” operator on array.

Now the “Fifth” element is still on index 5.
Hope you will be careful when using array_unshift next time.

mysql : change root password

May 24th, 2013 § 0 comments § permalink

Please note that this post doesn’t cover How to reset mysql root password if you are forgotten.

Recently I noticed that, its quite simple to change the root password of the mysql. mysqladmin command is quite handy for this.

mysqladmin -u<username> -p password <new password>

Here substitute <username> with root and <new password> with your new root password. Since we are passing -p option to the command, it will prompt for your old password.

Prompt for old password

Prompt for old password

Enter your old password and you are done.

You are done.

Thanks for reading.

set up a node environment

May 14th, 2013 § 0 comments § permalink

Setting up a development environment starts with installing a version manager, so that we can install different versions and switch and test to versions we needed. For nodejs development environment, I start with installing node version manager, NVM.

Installing NVM

The installation of NVM is quite simple, either you can run install script or do it manually by cloning the git repo. I find the install script as handy. | sh

OR you can clone the git repo

git clone git:// ~/.nvm

Then add the following to your .bashrc file. if you are using zsh, add to .zshrc file.

 . ~/.nvm/

Install the node

Install the node versions you need.

nvm install v0.10.5

npm.js will be installed by default with nodejs version > 0.10.0

Switch the version you need using the command

nvm use v0.10.5

Install packages

Now you can install the packages globally or locally, as your need. You won’t require to use sudo when installing packages globally.

npm install -g grunt-cli

Hooray, you are done. Try node on terminal to enter into node console.

Thank you.


Get ubuntu codename

April 7th, 2013 § 0 comments § permalink

Here is simple command which can give you the codeaname of your ubuntu distribution

here is result after running on my machine.

Ubuntu codename

Ubuntu codename