Crazy shell scripting

April 14th, 2009 by shashi

Not quite a mapreduce implementation :-D , but nevertheless …

while read l; do echo "SELECT id, email FROM tblName WHERE email='$l' ORDER by id DESC LIMIT 1;"|mysql -u root dbName; done < /tmp/dupes3.txt |grep -v 'email'|cut -f1|sed 's/^\(.*\)$/DELETE FROM tblName WHERE id=\1;/g' > /tmp/deletedupes3.sql

Exercise in futility … err … zenity

August 20th, 2008 by shashi

The other day, while working with some shell scripts I thought I could add some better usability into the mix – and hence whip up some dialogs using zenity (gdialog’s new avatar). And while at it, I had an enjoyable 20 minutes with good old unix concepts. Here:

I needed to figure out how to use zenity, the man pages didn’t tell much. So I went on a hunt for other scripts in the system that might use zenity; I was on Debian Etch system running the usual Gnome Desktop and quite a few applications from the Gnome bunch.


shashi@anacoluthon:~$ for p in `echo $PATH|sed 's/:/ /g'`; do find $p -type f|xargs grep -il zenity; done
/usr/bin/zenity
/usr/bin/gdialog

Eh! Only two programs and that too zenity itself and a wrapper over zenity for backward compliance. It’s not much popular is it ? If it isn’t why don’t I remove it from my system ?

$ su -c 'apt-get remove zenity'
Password:
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
gnome-desktop-environment zenity

uh! oh!! gnome-desktop-environment!!!??? WTF ? So, what dependencies does this package have ?

shashi@anacoluthon:~$ apt-cache rdepends zenity
zenity
Reverse Depends:
|ssft
gnuvd-gnome
|peercast-handlers
|eclipse-platform
eclipse-platform
eclipse
gnomemeeting
powersaved
gdm
gnome-desktop-environment

heh! heh!! So much for a core dependency. Should it be such a core dependency in the first place ?? Anyway it has it’s own place in the software trove.

An interesting tidbit about zenity. This was the first program I translated to Kannada way back in 2002-2003. But it never made it to the repository.

BTW, another interesting program: PySchoolClock

All in a name!

August 16th, 2008 by shashi

In our company, we have this tradition of naming our computers (Linux desktops, servers, etc) on a particular theme. Now, our chosen theme is Captain Haddock‘s choicest swear words. So, while caterpillar is our file server, typhoon our gateway, anacoluthon my laptop, rapscallion, rhizopod, jellyfish, balderdash, etc make up the other desktops.

Recently we hired a VPS for hosting some of our services. This time, we wanted to break out of the now monotonous theme and name it differently. Hence, we organised a small contest for suggesting the names and these were the names our guys came up with:

dooradabetta, ಅಗಸ್ತ್ಯ , ನಕ್ಷತ್ರ, Gogglers, Picaroons, Cyclotron, Bumblebee, Ironhide, Barricade, Optimus Prime, Prithvi -, Vismaya -, Amulya – Priceless, Arnav – ocean/ sea, Avinash – indestructible, bushbetta, Bandana, Maya – As in Illusion(Virtual), Rudra, Swastika, Varuna, Ugrana (Storage in Kannada ), Taatvika, sanctimonia (Latin), recondo, commodo, munus, muneris, lorica, officium, servitium, tutus, latrocinium, bisibelebath, kalasa, Abayan, Yuga
Vajra, Sambath, jataayu

That’s a neat variety of suggestions and lots of original thinking too. Finally, after almost a month I’ve decided upon one amongst the above.

bisibelebath :-)

Well, not exactly! in a shortened form – bcube. So the hostname – bcube.informedia.in

Thanks to Kaladisvarane for the name. And to all others too.

Free Operating Systems. Next"enta" ?

June 6th, 2007 by shashi

enta (ಎಂತ) in Kannada slang translates to “whither” as in “whither are we wandering ?“.

Over the past couple of months huge strides have been made in the development and deployments of several new free operating systems. While tracking their progress and goals, I’m writing down a couple of points for myself to revisit some time later and make an assessment.

Debian GNU/Linux: The universal operating system just shed a couple of architectures so that it is now that much less universal :-p. But nevertheless, with the “etch” release, they’ve managed to stick it to the Ubuntu folks and have regained the trust of thousands of Linux enthusiasts all over the globe. In addition to the main release with over 20,000 packages spanning at least 3 DVDs, Debian also has a thriving sub-projects culture which is progressing quite steadily. These sub-projects cover specialised applications including Embedded Debian, Debian Junior, Debian Edu, Debian Lex. All these positive vibes should take Debian beyond the hard core GNU users base it currently enjoys. But, the project has to overcome issues such as the Firefox/Iceweasel, GNU Free Documentation fiasco which can irritate neutral users no end.

Overall Debian is on it’s way to nirvana and helping it’s users attain nirvana.

Ubuntu Linux: The hot favourite amongst the middle class of operating system users, Ubuntu has also taken a step ahead to ensure it reaches the masses. Ubuntu is now available as an option with Dell. This is sure great news for customers, as hardware incompatibility and other issues might not occur. Ubuntu also did great with their 6.06 LTS release. We ourselves have deployed the same at many corporates and institutions. Ubuntu comes with semi-annual releases.

Red Hat Enterprise Editions and their forks: These are interesting distributions. Red Hat’s Enterprise Linux is just that. It’s enterpricey. It’s performance, It’s Ease of Use, It’s cost. Everything is so enterpricey. Some good souls have come out to give us less privileged folks, a taste of the enterpricey experience at a very less or at no cost. These include CentOS, Whitebox Linux. But the irony of the whole linux in enteprice is that Oracle themselves do a repackaging and provide support for Red Hat EL binaries. Why do they do that ? Simple. Oracle needs a base. According to them, Oracle itself can tune the kernel, support programs they develop on oracle.

Fedora Linux: What started as Red Hat’s staging area (??) is now a full blown enterprise capable distribution. It has a huge community built around who takes care of the packaging to the bug fixes, etc. Truly Red Hat has delivered it’s word that Fedora won’t be controlled by Red Hat.

Now the above Operating Systems were purely Linux based. What makes the scene much more interesting is that there are a couple of contenders for the growing (yet again) base of Unix users. These include Sun’s OpenSolaris, the BSDs.

Sun has been doing some real marketing amongst developers out there to adopt OpenSolaris for their development purposes. They have made available cutting edge tools including DTrace, ZFS available under an open source license. There have been several instances where attempts to port these to Linux/BSD are going on furiously. But Sun isn’t satisfied. The developers still do not trust Sun to play along nicely along open source rules. So, Sun has come up with something called Project Indiana. This has Ian Murdock (The Ian in Debian, Progeny founder) at it’s helm. He looks like he has some tricks up his sleeve. Let’s see if he can turn it around.

There’s also this project called Nexenta, which is again a Debian based distribution but uses Solaris kernel at it’s heart. And tries to recreate the Solaris environment.

Bottom line:
Projects, there are some
There are people using them
At office and home

Who does rule the roost
Will not necessarily be the best
But, try certainly will be doing the most