Monday, August 23, 2010

RHEL is hell

http://www.cyberciti.biz/faq/howto-install-c-cpp-compiler-on-rhel/

Thursday, August 12, 2010

Splitting strings in shell script

Nice way to pass parameters to a script is to put them in a properties file and then read the file in the script and do something with each parameter in the file. But often it is neccessary to pass more than one parameter for each line. One way to do this is to use some kind of separator between the parameters and split each line in the script using the separator. Here is one way to do it.

Example input file:

foo:2
bar:109
baz:23


To read this file, we can use script like this:

#!/bin/sh
for LINE in `cat input_file.txt`
OLDIFS=$IFS
do
IFS=":"
arr=($LINE)
echo "First: ${arr[0]}"
echo "Second: ${arr[1]}
done
IFS=$OLDIFS


The output should be:

First: foo
Second: 2
First: bar
Second: 109
First: baz
Second: 23

Thursday, August 13, 2009

Amazon sells virtual servers

You can actually buy (or rent) virtual servers from Amazon!
http://aws.amazon.com/ec2/

Friday, September 19, 2008

I missed the party!

Not only did I not get to go to the DjangoCon (and miss the official party), I also missed the local shadow party also. Damn.

Sunday, October 7, 2007

Unslunging the nlsu2

I finally got myself a nice little linux box. Or, actually it is a NAS adapter, a small box that can turn your USB drive to a networked NAS station. Nice thing about it is that it runs Linux and there is a community of hackers that provide an alternative firmwares for it. So, with a little tweaking you can get it running pretty much any software you want.

Well, now after reading the wiki and other instructions for a day, it seems that "little tweaking" is a relative term. For example, I would like to try to use a USB flash stick as the only "hard drive" for the system. However, to flash the new firmware all the discs should be formatted to ext3 file system with the NSLU2. But it won't format any flash drives. Duh. And the instructions for unslung (one of the alternative firmwares) explicitly says that the instructions should be followed step by step, no improvising. But there is no instructions for this case. And I know there are systems running with only flash drives.

And I don't have a cross-over ethernet cable that is needed if I wanted to connect the slug directly to my computer. And that is needed if I ever wanted to telnet to the box in recovery mode, let say, if I failed the flash and made a brick out of my brand new slug.

Well, I guess nothing can go wrong...

(Edit): And nothing did go wrong! I now have a nice little linux server on my desktop!



For some reason the package feed of ipkg is missing, so I can't really install any cool stuff (like mandatory ssh daemon) on it yet.