Sunday, February 3, 2013

कर्म (Work)

Karmanyevadi Karaste Maphaleshu Kadhachana
Ma Karma Phalahe Durbo Matesangatsvali Karmani" Bagavad Gita( 2- 48)

asks us to do our karma ( Work) and says that the benefits of the work will be rewarded.

तीरथ  पर जाये, बार बार प्रभू को मनाये, सोचे की शायद रूठा खुद मुझ से मान जाये 
फल, फूल चढ़ाये प्रभू को चप्पन भोग का प्रलोभ दिखाए, नंगे पाऊँ मंदिर, मस्जिद के सेकड़ो चक्कर लगाये 
पर ए बुद्धिहीन प्राणी, कर्म करे जा ये है प्रभू की गीता मैं वाणी 

Saturday, January 19, 2013

Mr. X on train Part-1

We generally used to board same train every day, he always comes in formal clothing, by his attires he looks like some kind of financial escort or some bank employee. He usually travel with black suitcase and smile on his face, But today I am sensing some worry on his face, may be some kind of meeting tension ? or some client is refusing to give money on stocks loss ? But no this tension don't look like that, something wrong with him.

Image from

Sunday, December 23, 2012

Do I know ?

Do I know about the river system of India ?
Do I know about the palmistry ?
Do I know about the reincarnations ?
Do I know about the History of India ?
Do I know about the Literature ?
Do I know about the facts ?
Do I have the knowledge of the maths ?
Do I know the path to attain knowledge?
Do I know the God?
Do I know the Satan ?
Do I know myself ??

from where do I learn this knowledge, there is only one answer for the question.

For me whole world is my teacher.


Sunday, October 14, 2012

Jumbled Sundays

What is Sunday ? The day with no work, no challenge or the day with lots of thought with full of imagination. Actually Sunday is the day in which you can explore tons of good options. Options to do something good with your life ? Or to make your lifestyle better than ever ? Or just lay in your bed  ? third one is more intuitive actually ;)

This question is keep bugging me from past few months. Actually my conscious mind wants to do something, something innovative or something different from my daily routine like playing guitar or like watching some thoughtful documentaries or reading some good books. But my subconscious mind wants totally different thing, actually it wants to be lazy after work of 5 days, my subconscious mind force me to do nothing, it just want to go in hibernate mode and try to be less thoughtful.

Still these are my mixed  Sundays. Hope for the change from next time.

Wednesday, October 3, 2012


पीर है मेरी बड़ी,
इस का कोई इन्साफ तो हो

रोज मेरे जख्मों का
जर्जर सही कुछ इलाज तो हो

राज़ बहूत ही गंभीर हैं
मगर मेरे सपनो का आगाज़ तो हो

इन पंखों के पैर नहीं
लेकिन इन मैं कुछ उड़ान तो हो

इस मन को कुछ लाभ नहीं,
पर मेरा कुछ नुकसान न हो

आज नहीं तो कल सही,
कहीं से  मेरी भी  शुरआत तो हो

Monday, June 13, 2011

Scripts of the week

Hi, blogging again after a long time. feeling lots of ups and down during the period..hell leave it for now..
I dedicate last week to writing the scripts, I wrote vim plugin for uploading and downloading the code to/from pastebin and also created an API using wurfl to detect the mobile device config and provide the run time support to it.

Vim Plugin Story :
Finally I wrote my own vim plugin, I had an idea long time ago, but never get the time to implement it, during this weekend I have nothing much to do so, I decide to go with the plugin and give rest to other tasks, I spend two days on writing plugin.
Plugin basically parse the HTML code using the beautiful soup python module. After getting the branch of the code text, I removed the additional HTML tags and copied it to the vim editor.

import urllib2
from BeautifulSoup import BeautifulSoup
import sys
soup = BeautifulSoup(''.join(data))
code=soup('div', {'id' : 'code_frame'})
soup = BeautifulSoup(''.join(str(code[0]).strip()))
code_text = soup.div.div

code_for_vim = BeautifulSoup(str(text).strip(), convertEntities=BeautifulSoup.HTML_ENTITIES)
print code_for_vim

above code print the code pasted on the valid link of the pastebin, this involves parsing of the HTML source and beautiful soup does it beautifully ;). I called above python script from the vim
function command! -nargs=0 PasteBin :call pasteCodeFromPasteBin()
which could be called by user from vim editor by typing :Pastebin.

fun! pasteCodeFromPasteBin()
let g:binLink = input("Enter valid pastebin link : ")
let g:data=system('python ~/.vim/plugin/ '.g:binLink)
set paste
exec "normal O".g:data

and for uploading the code directly from vim editor, I used pastebin api which require code to be pasted, language preference, email ID, title etc details passed as a post argument with an api, for this I used 'curl -d' and perl

let g:data=system('cat '.bufname("%").'| perl -p -e ''s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg''')
let g:query='paste_private=0&paste_code='.theg:data.'&paste_name='.g:name.'&paste_email='.g:pastebin_emailid.'&paste_format='.g:pastebin_language
let g:out=system('curl -d -s"'.g:query.'" ')

WURFL Story:
WURFL is a Device Description Repository (DDR), i.e. a software component which contains the descriptions of thousands of mobile devices with the help of WURFL I create an API which can detect not only the device but can also find the nearest match from the available configs and provide the run time support to it.

// Include the WURFL/Application.php file
require_once "WURFL_Installation_Dir/WURFL/Application.php";

// Provide the absolute or relative path to your wurfl-config.xml
$wurflConfigFile = "wurfl-config.xml";

// Create WURFL Configuration from an XML config file
$wurflConfig = new WURFL_Configuration_XmlConfig($wurflConfigFile);

// Create a WURFL Manager Factory from the WURFL Configuration
$wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);

// Create a WURFL Manager
$wurflManager = $wurflManagerFactory->create();

WURFL maintains the database in wurfl-config.xml file and which is created on the basis of the user agent of the different devices, by passing the argument of $_SERVER array to the WURFL API we can get the exact model, brand, device OS, resolution and other additional details. online doc available for getting different capability sets of the device.


Tuesday, November 16, 2010

Linux magical commands

Linux command like a magic stick in the hand of wizard, more you practice more you find scope of learning. I am playing with it from few years and still I find myself n00b in this context, although today I planed to share my n00b experience with you regards to few basic Linux commands . This POST is totally belongs to the beginners.

cat :
concatenate files and print on the standard output
$> cat file.txt gt; cat file.txt ##print the content of the file on terminal
$> cat -n file.txt gt; cat -n file.txt ##print the content of file with line number

grep :
grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
$>grep apple fruitlist.txt ##grep prints all lines containing apple
grep -w apple fruitlist.txt ##grep prints all lines containing apple as a word
You can also use grep with regular expressions

is a stream editor. A stream editor is used to perform basic text transformations on an input stream. While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.

$>sed -e 's/oldstuff/newstuff/g' inputFileName > outputFileName$>
##s Substitute command
##g global
##/../../ Delimiterday
##(oldstuff)Regular Expression Pattern Search Pattern
##(newstuff)night Replacement string

awk :
An AWK program is a sequence of pattern {action} pairs and function definitions. Short programs are entered on the command line usually enclosed in ' ' to avoid shell interpretation. Longer programs can be read in from a file with the -f option. Data input is read from the list of files on the command line or from standard input when the list is empty.
$>awk [ -F ] {pgm} | { -f } [ ] [ - | ]
##ch: Field-separator character.
##pgm: Awk command-line program
##pgm file: File containing an Awk program.
##vars: Awk variable initializations.
##data file: Input data file.

tr :
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
tr 'abcd' 'jkmn' ##maps 'a' to 'j', 'b' to 'k', 'c' to 'm', and 'd' to 'n'.
$>cat file.txt | tr -d '\n' ##delete new line character from file

curl :
Curl is a computer software project providing a library and command-line tool for transferring data using various Protocols.
$>curl -o example.html ##cURL can write the output it retrieves to a file with the -o flag