Make your terminal cool

4 Jul

Screen Shot 2014-07-03 at 4.01.45 PM


You can achieve this terminal look easily with few quick steps. In my case, I am using iterm2 in osx mavericks along with zsh powered by oh-my-zsh. I do know that its possible in bash too. My recipe does works in Mint, Ubutu too. Not sure of Fedora :( .. So lets begin.

Installing zsh and make it default shell

Install zsh using yum, brew or apt-get. In case of ubuntu run :    $sudo apt-get install zsh   . It will  ask for your password and finally it should complete its setup. Then we set zsh as default shell by running : $chsh -s /bin/zsh . To see the effect you have to logout then login. But dont logout now. As running zsh first time ; it asks to setup zshrc file for you. We want to logout after configuring our zshrc first.

Configuring oh-my-zsh

Lets quickly run few more commands. Dont blindly run commands try to understand each command .

$git clone ~/.oh-my-zsh
$mkdir -p ~/.bin/dotfiles/zsh/
$cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.bin/dotfiles/zsh/zshrc
$ln -s ~/.bin/dotfiles/zsh/zshrc  ~/.zshrc

By running all this we are setting our default zshrc file. Now you can logout and login again to find zsh as your default shell.

Installing ducknorris theme and Powerline fonts

You are so close. We have to configure ducknorris theme and powerline fonts. Download powerline fonts from here and configure one of the fonts in your terminal profile preference. Then create ducknorris.zsh-theme file inside ~/.bin/dotfiles/zsh/ducknorris.zsh-theme  .  Copy the theme content from that website and paste it into the file. Now run following command :

$ln -s ~/.bin/dotfiles/zsh/ducknorris.zsh-theme ~/.oh-my-zsh/themes/

Edit ~/.bin/dotfiles/zsh/zshrc file and change replace ZSH_THEME setting to following :




Reopen terminal to see your cool new terminal look. I usually keep all my dotfiles inside ~/.bin/dotfiles and sync them to a private repository in bitbucket. You can do that too. Have Fun !!

Drupal 7 Apache Solr Configuration

3 Apr

Thanks to lullabot for this nice post which produces exact output that it says. In my case i had to make few other changes in my CENTOS cloud server.


1.  Instead of recommended version of drupal apachesolr module; I took the dev version for solr configuration. 

2. You wont be able to access http://localhost:8983  

The reason behind this is firewall if you have iptables enabled . Open /etc/sysconfig/iptables and add following line:

# Tomcat Port
-A INPUT -p tcp --dport 8983 -j ACCEPT

Then restart iptables #/etc/init.d/iptables restart .  Now you can access tomcat server.

3. That article didnt speak much about security.  VISIT I found this post to secure SOLR admin panel. There is truncated tags in that XML . See the github gist  comment to fix this. 

4.  In drupal admin level use http://username:password@localhost:8983/solr/drupal 

5. Setup Tomcat to run on startup . This post of rackspace is useful. I did have to tweak few lines in that shell. I removed java path variables and put correct path to tomcat startup and shutdown shell.


Finally  configure the basic settings for solr inside drupal admin. I used drush solr-index  to index my contents. Thats it , Enjoy SOLR !


Resource:   This post discusses above security and configuration related to admin.


Admin_views Module with multiple user

2 Apr

Module URL:  admin_views

We use this module to provide nice filtering features for our client. In few cases we share create different roles based on client request. Such as, This particular user can only edit his contents or specific content types. A good feature of admin_views is that it does considers user permission and renders admin links based on that. But one problem is that if the site has huge list of contents; its hard to find a single content from a list of thousand items.

To make this user intuitive, we want to show only user contents in Content Management but for specific roles we will show them all. To do that follow these steps:

1. Go to Views and open edit form for “Administration: Nodes” .  Admin_views module utilises this module.

2. Add a contextual Filter Author: uid  . Click on “Provide Default Value” and choose PHP code. Note: If you dont see php code in here then enable PHP filter module from Modules.

3. Now put following snippet in the “PHP contextual filter code” :

global $user;

if( in_array( 'administrator', $user->roles) )
  return 'all';
  return $user->uid;

4. Finally Save the views .

Thats it . Now only administrator can view entire list but for other roles only authored contents will be visible to logged in user.

VIM really enhanced

12 Feb

I am a regular SublimeText user. Vim has always been my favourite editor of choice when i need to do small tweaks and etc. I kept an eye on recent vim plugins and posts made by numerous vim lovers. The ultimate goal was to make vim more easier and more friendly. Here are my tips and tricks that i used to make vim close to Sublime :

  1. Vundle : I have used pathogen to manage my plugins. Vundle takes plugins management to a whole new level. Think of it as Sublime Package manager. Just put the github repo name and run “BundleInstall” . Before you do this make sure your vim supports ruby and install Vundle in your system. To check if your system has ruby support run :
    $vim –version | grep ruby
    If nothing comes up then make sure you update your vim with ruby support.
  2. Vim-airline: Makes vim status and tab bar intuitive. Some cool themes for eyecandy.
  3. Vim-unimpaired : Buffer is a cool way to edit multiple files in vim. But switching them can be hectic. [b  a nice key map to switch between buffers.
  4. ctrlP : NerdTree provides a cool file explorer but nothing can beat the fuzzy search to load specific file. Those who have used it never looked back. This plugin provides the exact same feature in vim.
  5. vim-multiple-cursor : First saw this feature in Notepad++ . A very handy way to refactor code lines. Better than typical Search/Replace.


Finally there are tons of dotfiles around . Dont copy and paste those into your vimrc. I used to do that which does not helps you to learn. Instead pick one dotfile then try to understand each lines. Only move those that you think will help you eventually.

My vimrc file. :)


11 Feb

Lots of complains adopting git, is not to have a server that support ssh let alone git. A nice post by jefferey way in nettuts suggests deployhq. Thats a nice service with nice GUI . But i was looking for a free solution and found one under a comment in that post.

This not only provides FTP protocol also support SFTP. Here are the steps that i took in my mac os environment.

  • I used brew to install git-ftp:
    $brew install git-ftp
  • This relies on libcurl so next thing i had to install curl with ssh support :
    $brew install curl –with-ssh
  • Brew does not overrides default curl library that comes with osx,  so i had to replace that using
    $sudo rm /usr/bin/curl
    $sudo ln -s /usr/local/Cellar/curl/7.35.0/bin/curl /usr/bin/curl
  • Now I cd into my repository and run :
    $git ftp init -u <username> -p – sftp://<host_url>/<path>
  • It syncs my current HEAD branch into the server and keeps track of last commit. So after making few other commits, i am ready to push latest changes to server. By running:
    $git ftp push -u <username> -p – sftp://<host_url>/<path>

I hope from now on you will use GIT for server deployment.

NOTE: git-ftp stores commit log in a file .git-ftp.log file. If any mishaps happens or you want to re-sync everything. Remove that file and you are good to go.

Sublimetext Package: SideBarEnhancements

20 Apr

This is one of those packages that should be in core. This enhances the default simple sidebar with additional operations.  You can install this via Package Control or from their git repository.


Sublimetext Plugins: Gitgutter

19 Apr

I am going to write series of posts showing my favorite plugins for Sublimetext editor. Sublimetext is one of the coolest editor around. Today we are going to learn about gitgutter . If you are using git for versioning then you have to have this plugin.  It shows a realtime git diff in your editor.


I was looking for  a plugin like this when i switched from netbeans. Netbeans has this cool plugin named nbgit which i loved most.

I hope this plugin grows more powerful.  BTW you can install this via package control too. More details


Get every new post delivered to your Inbox.