Syndicate this site. Individual category archives are available too. Recent Entries

Bangalore Coonoor on Royal Enfield
Bash infinite loop script
Remove duplicate jars
Quick Ref: Linux Mint 11 #1
Quick Ref: SVN command line
Git with Dropbox
Quick Start: Git for personal use
Quick script to maintain a diary
Bicycle Diaries - I
Simple MongoDB+Java example

Blogroll: Other sites I read.


Categories: with XML

April 2014
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Disclaimer: These are my personal views, opinions and experiences. These do not reflect the views or experiences of any of my employers or clients.

Movable Type: A personal blogging system

Bangalore Coonoor on Royal Enfield

Quick view of my bike ride from Bangalore to Coonoor on 2014-04-03.

Route is indicated by green icons on the map. Return was on next day, indicated by red icons. Each marker was done when I had stopped for at least a 5 minute break. Click/hover on the marker to get info and odometer reading.

Open Google Route Map


Outside Ramanagaram.
Outside Ramanagaram at 6:30am. From here till Mysore, 2 hours non-stop ride!

More »

March 31, 2014

Bash infinite loop script

There are times when cron won’t do for automated jobs. Classic example is when you need to start a script, enter some data and then get it into cron. Now, in most cases this can be handled by having env variables or config files. However, what if some one needs to enter a secret value? You don’t want that stored in the filesystem anywhere. For situations like these, you can get inspiration from the following script.

More »

June 17, 2012

Remove duplicate jars

Often you will find that you’ve multiple versions of the same dependency jars in your WEB-INF/lib or your classpath directories when you are merging multiple modules. This small shell script can be run on those directories to get rid of older versions of the same jar.

#in a directory full of jar files, it is common to have multiple
#versions of the same jars. If versions are named with only periods
#and alphanumerics, then this groups the jars by the name, deletes
#all the lesser versions

#get a list of jars like x-1.0.0.RELEASE.jar, get only the jar name
#without version or .jar and get only non unique lines (ie., duplicate
#jars are found)
for PREFIX in `ls *.jar|sed  ’s/-[0-9\.a-zA-Z]*\.jar//g'|uniq -d`; do
    echo $PREFIX
    #now do a reverse sorted listing with the jar name and remove the
    #top line so that non latest versions are returned
    for FILE in `ls -r ${PREFIX}*|sed '1d'`; do
        echo "  $FILE"
        rm -f $FILE

August 21, 2011

Quick Ref: Linux Mint 11 #1

To force a filesystem check on root filesystem on next reboot, do:

sudo touch /forcefsck

To restore the gnome panel to defaults:

gconftool-2 --shutdown
rm -rf ~/.gconf/apps/panel
pkill gnome-panel

If clicking on any file location from say google chrome download list or other links gives an error the requested location is not a folder:

sudo apt-get remove exo-utils

August 17, 2011

Quick Ref: SVN command line

#make a working dir
mkdir sandbox
cd sandbox
svn co svn://svn-repo-machine/repo/path myproject --username myusernameatsvnserver
#go to work on items
cd myproject
#pull latest from server
svn up 
#queue a file for addition
svn add newfile.c
#queue for deletion
svn delete anoldfilewedontneed.c 
#get the info on what is different in your local vs server
svn status 
#list commit comments on a file
#commit one file. * will commit all that changed.
svn ci -m "Edited this file for ..." filethatgotchanged.c 

Now, configure vim as the svn diff tool.

August 14, 2011

Git with Dropbox

First, check out Git for personal use. Extending those principles to Dropbox is fairly easy.

cd ~/Dropbox
mkdir -p gitroot/research.git && cd !$
git --bare init
cd ~/Projects
git init
git remote add dropbox file://$HOME/Dropbox/gitroot/research.git
git add testfile.txt
git commit -m "initial"
git push dropbox master
ssh anothercomputer
cd ~/Projects
git clone -o dropbox file://$HOME/Dropbox/gitroot/research.git
cd research
ls >> testfile.txt
git commit -m "just testing"
git push dropbox master
git pull dropbox master

For the first computer, once you fill the bare repo with some stuff, you can delete the folder and do a clone like how you did with the second computer.

Older Posts