May 25, 2005
Quotes
Meditation is not an escape from life... but preparation for really being in lifeThich Nhat Hanh
To find perfect composure in the midst of change is to find NirvanaShunruyu 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
May 21, 2005
heresy
Heresy is only another word for freedom of thought.-Graham Greene, novelist and journalist (1904-1991)
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
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
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
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.
May 02, 2005
Positivism
Religion is an illusion of childhood, outgrown under proper education.
--Auguste Comte