Checking a list of IPs against RBL

This is more a reminder to myself than anything else … this is small snippet that takes a list of IPs and does a whois on all that aren’t in a RBL

Lets say we have al list of IPs in a file “iplist.txt”:
12.172.121.171
24.149.208.68
38.105.100.9
58.185.207.86
61.201.51.66
64.78.164.169

Snippet that checks the IPs (can of course be easily changed to check IPs that are IN a RBL)

bash: using the content of a variable as variable name

Since the implementation of Arrays in Bash is somewhat lacking compared to higher level programming languages (only one-dimensional), and hash lists require a bit of work to set up, you may run into a situation where you have a small list of key/value pairs that are both variable and you need to store.
There are various solutions for the problem, e.g. creating two arrays (one for the keys, one for the values, and combining them by using the same index values for the entries), or using the functions from the link above to build a hash list. For me the easiest way to solve the problem, if I only have a few variables and don’t want to bloat the code, is to (mis)use declare. declare is intended for setting the type of a variable (constant, array, integer,…), but has the nice side affect that you can use variables in the key name, and you can set the value of the variable.

usage:
declare ${Key}=${Value}

Example:
$File_Config is variable holding the name of a configfile, the content of the file could look like this:
foo:one
bar:three
foobar:bignumber

Snippet:

after the snippet has read the configfile, you can use $Configuration_foo, $Configuration_bar and $Configuration_foobar in your script. The keynames could also have came from a mysql query, array, command line args, …

back online

The hard drive crash threw me offline a few days due to strange problems with software raids, Xen and acpi. Turns out that using the latest Xen kernel from debian testing branch on a software raid only works of you don’t set “acpi=off” as a kernel parameter. If acpi is turned off, the script “scripts/local-top/mdadm” in the initrd can’t find the devices needed to mount the software raid … causing the whole boot process to come to a grinding halt.

If I find some time I’ll do some more tests, untill then my server will be running with acpi turned on

btw. the hard disk replacement was easy. after the new drive was popped in it was just a copy the partition table and add the partitions of the new disk to the raid

dead hard drive

It seems that one of the hard drives in my server died last night. Thanks to the raid no data is lost, but the server will be offline shortly this week (tuesday morning probably) to replace the faulty drive with a fresh new one.

Adobe Lightroom 3

I always shoot in RAW + JPEG. For normal point-and-shoot vacation stuff I’m generally satisfied with the JPEG the camera spits out. But I would never shoot only JPEG. The additional information of RAW shouldn’t be underestimated, and to be honest I often tweak around. It makes a difference if you are working on the original RAW data, or if you are working on the JPEG copy the camera has already processed.
Up till now I’ve been post-processing my images with Adobe Bridge and Photoshop CS3. Since I was planning on post-processing a whole load of pictures I decided to see what software there is out there to streamline the work flow a bit (Bridge and CS3 do the job, and the raw converter in CS3 does offer a wide variety of options, but it is still tedious switching to be switching between both programs and working on multiple RAW images at the same time). While I was away, Adobe released Lightroom 3, so I checked out the reviews and it sounded good. I downloaded the 30 day trial version and to sum it up my experience so far … I’m impressed.
I haven’t worked with Lightroom previously, so I can’t say how much has changed in this version. But I really like the details that make life easier when handling collections of images. Being an Adobe product it also offers interfaces to various Photoshop functions (I only own CS3, I could imagine it offers more options if you have the current version CS5 installed). I could go on and on with things I like about it, but I’ll just sum it up and say: It really streamlines the work flow of post-processing photographs from import to print/upload/web/presentation and if you are shooting RAW it has a whole lot of fun stuff to play around with directly built in.
Since I shoot with a Nikon D80 that tends to produce a fair amount of image noise if I go past ISO 400 I liked the noise reduction features of Lightroom, both color and luminance noise can be reduced greatly with sliders for fine tuning.

It’s a good piece of software, and when the 30 day trial ends I’ll probably go buy it.