Vattekkat Babu

Subscribe to Vattekkat Babu feed
Gluing passing thoughts to foregone conclusions
Updated: 12 hours 17 min ago

Setting up Xubuntu in Lenovo Flex2 14D

Tue, 2014-09-16 01:29

Lenovo Flex2 14D is a good laptop with decent build quality, light weight, 14" screen and touch screen for those who like it. With AMD A6 processor version, it is reasonably priced too.

It comes pre-loaded wth Windows 8.1 and a bunch of Lenovo software. If you want to get this to dual boot with Ubuntu Linux, here are the specific fixes you need to do.

How to beat workday blues?

Fri, 2014-08-15 07:37

Let us face it - all of us feel like having achieved or done very little after spending a long day away from family. Then you look back and find that you could've spent some of that time with family at least!

I've been observing my work habits a lot and I think I have found out something that works for me.

I am summarizing these as a NOT-TODO list of 3 items. I am a software engineer by profession and by passion.

Has this worked for me? Absolutely much better than when I was not following these rules.

Bangalore Coonoor on Royal Enfield

Sat, 2014-04-05 12:28

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

Onward

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

  • Early morning traffic was peaceful. Nobody on the roads to Mysore really. Very different when you are driving on weekends though.
  • Route was Sony World - Hosur Road - NICE Road - Ramanagaram - Mysore City - Nanjangud - Gundlupet - Bandipur - Theppakkadu - Masinagudi - Ooty
  • Overall about 330km. Took about 8 hours with about 1.25 hours break.
  • I was apprehensive of climbing the Kallatti Ghat on a relatively new bike. Just pushed it - it climbed with no drama.
  • Steady speed of 60kmph was followed mostly. Once in a while, went up to 70kmph for less than 1km, just to try the bike.
  • The waterhole near Bandipur visitor's center has all the trees burned down. Quite bad. This is the place where I had seen elephants, bisons and even a tiger across the road once before.

Bash infinite loop script

Mon, 2014-03-31 00:42

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.

Remove duplicate jars

Sun, 2012-06-17 02:32

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.

#!/bin/bash
#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
    done
done

Quick Ref: Linux Mint 11 #1

Sat, 2011-08-20 23:50

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

Quick Ref: SVN command line

Tue, 2011-08-16 20:57
#make a working dir
mkdir sandbox
cd sandbox
#checkout
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
svn log AFILESOMEONECHANGED.c 
#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.

Git with Dropbox

Sun, 2011-08-14 13:38

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.

Quick Start: Git for personal use

Tue, 2011-08-02 13:50

Problem: Needed to find a way to keep my config and research files under version control which I can get to various machines I work with and update from anywhere.

  • I have an OpenBSD server account (no root though)
  • I don't want to run any additional daemon process or expose it via http
  • I can download and compile source if it can be installed as a non root account
  • Transport must be via SSH
  • I don't need GUI tools, speed should be reasonable

Tried Mercurial, Darcs, Bazaar and Git. Fossil is also a great tool that provides wiki, version control and ticket management. Darcs is the easiest, but for some reason, extremely slow. Finally chose Git. Download and compile was easy. Read top 3 lines in the INSTALL file in source distribution for steps. Rest of the steps explain how I set it up. Note that this may not be the best possible Git workflow. Merely that it works for me. Note that I've installed git in ~/software/git.

Quick script to maintain a diary

Fri, 2010-07-30 01:30

I like to keep my daily notes in a folder in the filesystem with filenames yyyymmdd.otl, using VIM Outliner. Here is a small DOS script to make a file for a day if it doesn't exist and then open it. Name it as diary.cmd and keep in your path.

Bicycle Diaries - I

Mon, 2010-05-03 00:41

Once I entered work life, physical activity was pretty much restricted to keyboard and mousing. I hate running. I like only Cricket, Badminton and Table Tennis for sports. All need others to be available. I love to swim, but in Bangalore where I stay, it is not very convenient. I used to enjoy cycling when I was in school. Some six months ago, bought one (Hercules ACT 104). Rode it on and off for 4-5 short trips. While it is enjoyable, I never stuck to a routine. Since I am on vacation now, I thought I will attack it as a 2 week project and see if I can actually do it.

If you are a fitness freak, don't bother. I am talking about 5km as a goal - if you routinely do 15km+, you might find this quite boring.

Simple MongoDB+Java example

Tue, 2010-03-02 04:03

MongoDB is pretty slick for ease of use and scalability. As part of figuring out how to interface with MongoDB, I wrote a simple Java class that gives you an idea about how to create a collection and do CRUD on that. See below. Quite a bit of information is available on the web, but I thought a sample that shows off all the basic things will be useful. Good link - notes from a production mongoDB deployment

Cisco's new urbanism

Sun, 2010-02-21 00:17

Fast Company's article about Cisco's vision for New Songdo is a fascinating read on smart cities. Perhaps all connected, with all the apartments being able to do lot with network via great functional phones feeding off mobile platforms?

Labelling in Outlook 2003 ala Gmail

Sun, 2010-02-21 00:01

I found that moving mails into project folders, when the mails are still on an open topic takes too much time. Gmail's "label" idiom really helps in this situation. Turns out we can do that with Outlook 2003 too with some small macro work. First, see my entry on how to put macros and arrange toolbar in Outlook 2003. Then add the following macro to the module. Duplicate the second subroutine to as many as you've categories and then put toolbar entries for each of those. I think you should be able to do with less than 10 categories. At times you may get mails on an old subject, which you can just read and act and archive directly without tracking it.

Sub SetCategory(strCat As String)
   Dim Item As Object
   Dim SelectedItems As Selection
   Set SelectedItems = Outlook.ActiveExplorer.Selection
   For Each Item In SelectedItems
   With Item
    .Categories = strCat
    .Save
    End With
   Next Item
End Sub

Sub SetCategoryAdmin()
    SetCategory ("Admin")
End Sub

Quick Bazaar on Windows over SSH

Fri, 2010-01-08 22:05

Quick notes on how to set up a version control system using Bazaar with just SFTP and Windows client.

  • Get a Unix/Linux machine that you've an account and that supports SSH.
  • Create a directory, say /home/loginid/repository
  • On your Windows machine, download pageant.exe and puttygen.exe (at a minimum) from PuTTy site.
  • Start puttygen.exe, generate your private and public key pair. Save private key somewhere. C:\Documents and Settings\\.ssh\id_rsa is a good choice. Exit puttygen.exe.
  • In your server, make a .ssh directory, create a new file called authorized_keys, paste the public key into that file without any line breaks.
  • Start pageant.exe. Right click on the icon (terminal with a hat) on the system tray, add key and choose the private key file.
  • Download and install Bazaar Windows version.
  • Start it Bzr in command line.
  • Create the remote repository like bzr init sftp://username@remote/home/loginid/repository
  • Create a local directory, create a repository there too.
  • Add some files to local repository.
  • When you want to push it up to remote, do bzr push sftp://username@remote/home/loginid/repository

For more info, read Bazaar doc.