Thursday, August 16, 2012

XServer for windows

A combination of Xming and putty works very well when you have to ssh to a Linux/Unix machine and open GUI based applications like gvim and tkdiff.
Download xming from here ...
http://sourceforge.net/projects/xming/

Add the IP of the remote linux machine from which you plan to open X applications to the X0.hosts file under the Xming installation directory. This file usually has localhost already added in the first line.
A sample X0.hosts file will look like this.

localhost
192.168.1.3

On the remote Linux machine add this piece of code to your .bashrc file to set the DISPLAY environment variable to the IP of the windows machine. I got this handy piece of code from here

if [ ! $DISPLAY ] ; then
    if [ "$SSH_CLIENT" ] ; then
        export DISPLAY=`echo $SSH_CLIENT|cut -f1 -d\ `:0.0
    fi
fi

That's it! Now ssh into your remote linux machine and run the "xterm" command to verify that things are working. If all went well an xterm window should pop up on your windows machine.

Wednesday, June 13, 2012

Running Jboss on a different set of ports

The command below runs jboss on port 8180. It basically adds 100 to the default ports set.
 
run.sh  -Djboss.service.binding.set=ports-01

Tuesday, May 8, 2012

Simple bash while loop

I used the simple command below to execute a maven build task multiple times. Modify it to suit your needs.

Monday, February 13, 2012

git commands

Exporting a directory from a git repostiory ...
Go to the directory you want to be exported and run the following command.

git archive dev | tar -x -C /dest/directory/

In the above command replace "dev" with whatever branch you desire to export.
Add a user ...
# adduser abhilash

Add a new group
# groupadd appadmin

Add an exisiting user to an existing group. The command below adds the group as one of the users secondary groups.
# usermod -a -G appadmin abhilash

Change umask for a user to ensure only his group can access files he creates. This is done by adding the following umask command in the .bashrc of the user...

umask 007

After adding the above line the user should login again to verify his/her umask. If correctly done the user should see something like this ...

[bus@localhost ~]$ umask
0007
[bus@localhost ~]$ umask -S
u=rwx,g=rwx,o=
[bus@localhost ~]$

Thursday, February 9, 2012

rvm notes

RVM - A great tool to manage multiple version of the ruby interpreter.
I mostly use rvm to upgrade to the latest version of ruby 1.8.7 whenever a critical patch is released.

Follow these simple steps to setup rvm on your mac or linux machine..
RVM Basics

Command to upgrade to a patch version ...

rvm upgrade ruby-1.8.7-p352 ruby-1.8.7-p357

In the above command we upgraded from patch version 352 to 357.

Command to install a certain version of rubygems ...

rvm install rubygems 1.3.6

Running rake from within rvm for your rails project ...

rvm rake gems:install