Linux

The story of my experiments with linux :)

Recursively remove spaces/special characters from files/dirs

I have often found the need to remove space or any special characters from files/dirs present in a bunch of directories and its sub directories. Here is how I do it

First cd to the base folder and then

e='s/[ #,]/-/g'; find . | while read f;do c=`basename "$f"`; b=`echo ${f%$c} | sed "$e"`; rename -v "$e" "$b`basename "$f"`"; done

Whats happening here ? Lets look at it step by step

e='s/[ #,]/-/g';

SPP patch for qmail + jms patch

We are in the process of shifting our servers which meant setting up of all needed services on the new server. One of the services was email. Qmail has always been my choice for a mail server. I have never really got to the details of qmail installation as most of the work was handled by a script written by Vamsy which was based on QMR. I am a big fan of Qmail-SPP as it provides a plugin interface to qmail-smtpd. This makes it possible to extend qmail-smtpd's functionality by scripts, programs etc without much knowledge of qmail intricacies.

I used qmail-spp to do a variety of things like greylisting, valid recipient check, RBL checks, user wise outgoing mail restriction etc. Not that they cant be done otherwise, but most required patching qmail. So this time around, vamsy found a fantastic combined patch by John simpson which is a one stop patch for qmail. But after this patch the qmail-spp patch would not work. Though John's patches and scripts do almost everything I need (except for a couple), I would feel comfortable only when I know that qmail-spp is available. Hence, here is my attempt to create a qmail-spp patch which can be applied after the jms patch.

Tiff Plugin 0.3.2 released

Version 0.3.2 is released. This version has some very minor changes as follows

  • Bug fix to make it work with Ubuntu 7.10
  • Minor changes to Makefile

Download here

I have been checking out Xcode on the mac and hopefully should get myself to port tiff-plugin on the mac too...... But Xcode is sooo much of a clutter :( !!! Probably I dont know much about it.

Wireless adapter ( network with WEP encryption)

Last time, I was working on an open wireless network. In case of WEP encryption, just add the following commands to above the lnxreq_autojoin line which you can find here

wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKeyID=0
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11ExcludeUnencrypted=true
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11PrivacyInvoked=true
wlanctl-ng wlan0 dot11req_mibset mibattribute=dot11WEPDefaultKey0=xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx

Replace the "xx:xx:..." with your WEP key. In case of 128 bit, it will be 13 hexaedcimal values.

Usb Wireless Adapter quick howto

A quick howto for debian and ubuntu based systems for setting up usb wireless adapters. Just plug in the usb adaptor and do the following (All commands must be run as root user or prefixed with sudo)

apt-get install linux-wlan-ng pcmciautils wireless-tools

Then, shut down all your network interfaces. Suppose you have eth0 and eth1

ifconfig eth0 down
ifconfig eth1 down

Then,

modprobe prism2_usb prism2_doreset=1
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable

If the above did not return any errors, then you are almost through. Now, you need to scan your wireless network for any access points to connect to. To do this run the following command

Mozilla Tiff Plugin

Mozilla Tiff Plugin is mozilla/netscape compatible plugin for viewing tiff images. Features include

  • Zoom in - keyboard shortcut '+'
  • Zoom out - keyboard shortcut '-'
  • Rotate anticlockwise - keyboard shortcut 'a'
  • Rotate clockwise - keyboard shortcut 'c'
  • Progress bar when downloading images

Currently, a general purpose mozilla plugin for any mime type is mozplugger. Mozplugger works by spawning an application of the users choice for a particular mime type. After spawning the application it reparents the application window handle so that it gets into the browser.

VNC Monitoring - 2 minute howto

Ok, Ok stop the abuse! I know monitoring sucks! But, its a couple of users who seem to be surfing porn sites. I just wanted to confirm and prove that they actually are spending a huge amount of the company's work time surfing porn or chatting. Ok, there should have been restrictions, but i believed that every user is responsible enough and would respect the freedom given to them. It clearly was not the case!( That theory would probably work in an organization having like minded people with equal progressive pay structures - a weird but kind of ideal concept that sandeep would know :) .)

Anyways, enough of the blah blah. All user machines are configured to network boot and have no hard disks. The operating system for all users is Debian GNU/Linux. The management wanted to visually monitor what the user was doing. VNC was the first thing to come to my mind. With Debian all around, it was just a matter of apt-get and some shell scripting. No log outs, reboots( reboot would be insane....what about my uptime? ) etc to get this whole thingy working.

Exploring the Mandelbrot Set

The Mandelbrot or M set is considered to be the most complex object in mathematics and probably the most complex object ever seen. The Mandelbrot Set is an infinite object that always looks similar but never repeats!
But at the same time, it is generated by an amazingly simple formula,

Z(n+1) = Z(n) * Z(n) + C
where C is a complex number which acts as a viewpoint in the XY plane
and Z(0) = 0

Complex numbers basically consist of a real and imaginary part. The imaginary part is suffixed with a "i" whose value is sqareroot of -1. It is interesting to note that

Experiments with NFS mounted rootfs

This is a piece of my voilas with nfs mounted root directories.

Some History

At our office we started with around 15 people. We mainly deal in work involving processing of claims
which from the application perspective boils down to the browser and a word processor. Luckily, I was
given freedom to handle the technical aspect of the whole setup.

I immediately decided on network booting as the best solution. No hard disks!. No installation chores!.
Instant updates! So I set up a linux box with dhcp,tftp and XDMCP forwarding. All machines had more or
less the same motherboard/configuration, so i compiled all the drivers into (no modules) the latest 2.6

Where are my fonts?

To find out fonts that the X server supports run the following command

xlsfonts -u -fn '-*' | less

The above should give you an unsorted list of XLFD (X Logical Font Description Conventions) names.

To find out the font path one simple way that should work on all distributions

find / -name fonts.dir

To find out all fonts that are aliases to other fonts

find / -name fonts.alias -exec cat {} \; | less

I am writing this for my reference as i tend to forget them :)

Syndicate content