May 25, 2005

Quotes

Meditation is not an escape from life... but preparation for really being in life
Thich Nhat Hanh
To find perfect composure in the midst of change is to find Nirvana
Shunruyu Suzuki
Loneliness... is and always has been the central and inevitable experience of every man.
-Thomas Wolfe, novelist (1900-1938)
The shepherd always tries to persuade the sheep that their interests and his own are the same.
-Stendal (Marie Henri Beyle), novelist (1783-1842)
Plato having defined man to be a two-legged, animal without feathers, Diogenes plucked a cock and brought it into the Academy, and said, 'This is Plato's man.' On which account this addition was made to the definition: 'With broad flat nails.'

Diogenes Laertius
--Lives of the Eminent Philosophers

Posted at 09:33 AM

May 21, 2005

heresy

Heresy is only another word for freedom of thought.
-Graham Greene, novelist and journalist (1904-1991)
Posted at 10:13 AM

May 17, 2005

Big Bang

This was a great read. I can almost claim I understand the space-time continuum and the general theory of relativity - especially the relativity of the speed of light. Einstein really shook things up and really delayed the acceptance of the 'expanding theory of the universe'

Amazon.com: Books: Big Bang: The Origin Of The Universe

Posted at 09:22 PM

Short simple scripts

Every now and then I get to write some scripts to fetch the required data from a file. These days I'm having to deal with the Sybase interfaces file. I need to translate from a server name to the host and port.

This file can be large and the format is of the form:


SERVER
query tcp ether host1 1234
master tcp ether host1 1234

Grepping with a multi-line regex can be a pain. So here is one solution:

awk '/SERVER/{f=1}f>0{f++};f>2{print$4" "$5;exit}' interfaces

Wait. On Sun systems Sybase sometimes uses TLI for the host/port so the file can look like this:

SERVER
query tli /dev/tcp \x000208fca60e123f0000000000000000
master tli /dev/tcp \x000208fca60e123f0000000000000000

The following awk script can handle this case:

awk '/SERVEr/{f=1}f>0{f++}f>2{ if($2=="tli") print $5; else print $4:; exit}' $SYBASE/interfaces

Finally we need to convert back from the TLI format to host/port. Here is some javascript that can do that (assuming val has the string).

port = parseInt(val.substring(2,6),16);
host = parseInt(val.substring(6,8),16)
+"."+parseInt(val.substring(8,10),16)+"." + parseInt(val.substring(10,12),16)+"." + parseInt(val.substring(12,14),16);
print ("host "+host+" port "+port);

And if you decide you want to filter crontab files for a certain program here is something:

crontab -l | sed -n -e '/^#/d' -e '/string/p' | awk '{print $6}'

References:
sed FAQ, version 014
Awk reference

Posted at 08:53 PM

May 08, 2005

List of tables

SQLZOO, How to.. Get a list of all tables

How do you get the list of tables in a schema or database:

DB2: select * from syscat.tables where tabschema='SCOTT'

Sybase: select * from sysobjects where type='U'

Oracle: select * from cat

Posted at 03:01 PM

Me talk pretty one day

Amazon.com: Books: Me Talk Pretty One Day

Finally back on the wagon - reading or in this case listening. Me talk pretty one day is a set of essays - read by David Sedaris. Sometime they are funny other times they're just blah.

Posted at 11:29 AM

May 02, 2005

Positivism

Religion is an illusion of childhood, outgrown under proper education.


--Auguste Comte

Posted at 08:07 AM
Search


Archives
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
Recent Entries
Omnibus disputantum
Zen and science
Do not be
A map of Madras
Gift Giving
Abstract Expressionism
Magritte's Pipe
Is it a Bird? A work of Art?
Feminism
Newspaper boy problem
Categories
business
general
history
misc
philosophy
pop-culture
quotes
tech
Blogs
Metafilter
Arts and Letters Daily
Sapta-Sindhu
Beemblog
Misc...
Movies seen
Books read
Bush Says