Changed the layout of this Site around, will probably take a few days before everything is back to normal,
laters,
Overrider
I Subscribed to the daily Currency Exchange Table Mail from xe.com , based on the USD. I get the Mail in Maildir Format onto my mailserver. I needed a way to process Files in that Folder, get rid of everything except the actual Rates Table, save it as a textfile in a webfolder named after the associated date, and also generate an extra small file called active_rates.txt, which contained a few selected Rates calculated against each other and the US Dollar. Maybe someone finds this useful or wants to learn something about awk (which is awesome..and fearsome), so here goes:
#!/usr/local/bin/bash
maildir="/path/to/maildir"
workdir="/path/to/destination/dir"
file="/path/to/active.txt"
if ! [[ -f "$file" && -d "$maildir" && -d "$workdir" ]]; then
echo “One or more of your Variables could not be found”
exit 1
fi
cd $workdir || exit
for file in $maildir/*
do
[ -f "$file" ] || continue
DATE=$(awk ‘/Rates as of/{print $4}’ $file)
sed -n -e ‘/Rates as of/,/ZMK Zambia Kwacha/p’ $file | awk ‘!n[$0]++’ > $DATE
newname=$(echo “$DATE” | sed ’s/[^0-9]//g’)
[ "$DATE" = "$newname" ] && continue
[ -f "$newname" ] && continue
mv “$DATE” “$newname.txt”
done
if [ -f "`date +%Y%m%d`.txt" ]; then
cp -v `date +%Y%m%d`.txt active.txt
elif [ -f "`date -v-1d +%Y%m%d`.txt" ]; then
cp -v `date -v-1d +%Y%m%d`.txt active.txt
elif [ -f "`date -v-2d +%Y%m%d`.txt" ]; then
cp -v `date -v-2d +%Y%m%d`.txt active.txt
else
echo “Rates havent been updated, maybe the Mail didnt came in ?”
fi
#STARTING TO CREATE THE SHORT VERSION, ACTIVE_SHORT.TXT
(
echo “============================================”
awk /”Rates as of”/’{print $1 ” ” $2 ” ” $3 ” ” $4 ” ” $5 ” ” $6 ” ” $ 7}’ $file
echo “============================================”
for a in USD EUR CNY HKD TWD JPY; do
echo “RATES for $a”
for i in USD EUR CNY HKD TWD JPY; do
[ "$a" = "$i" ] && continue
awk “/$a|$i/ { if (\$1 == \”$a\”)dN = \$NF; else dD = \$NF; } END { print(\”\t 1 $a equals $i\”, dD/dN);}” $file
done
echo “”
done
echo “============================================”
awk /”Rates as of”/’{print $1 ” ” $2 ” ” $3 ” ” $4 ” ” $5 ” ” $6 ” ” $ 7}’ $file
echo “============================================”
) > $workdir/active_short.txt
This basically places a rates table.txt file and an active_short.txt in the folder you specify. An example of this short version is here .
This could be improved as always; but for me currently it works fine, being called once a day by cron. Its annoying that it reprocesses all the Mails, but currently it only takes like 15 seconds for 2 years of rates mail; so i will leave it as is for now. Feel free to improve it though, and send it to me then ![]()
I have a Panasonic Web cam Model BL-C131E , which transmits Pictures in Jpeg Format to my FTP Server. Basically, even though i configured the Camera so it only shoots and transmits Images when there is activity, the Folder that is used to hold the Images becomes HUGE quickly. Not huge in size, but a huge total file count, which makes it almost impossible to view the Folder from within a Finder Window. Try to view a Folder with 100000 Items in it, it gets annoying soon enough. Long story short, i came up with this Shell Script which i run periodically inside my Picture Folder. This little Program goes trough all the Files, creates a Folder Hierachy by Days and Hour of the Day, and sorts all the Pictures into them. You can easily adjust this for your own needs. Notice that my Web cam saves the Pictures using a timestamps as the Filename. Example: 20080221193828458.jpg . From there i extracted the Date and the Hour of the Day. Your Mileage may greatly vary, so use at your own Risk. I have tested this thing on a Folder with 100000 Files, and it finished in like ten minutes. Surely that can be improved, but in general, i never ever sort 100k of Pictures. I did not test for anything else, because i know the Filenames look always the same. Not sure what happens if there are spaces or other characters in the Filename, so be careful.
#!/usr/local/bin/bash
for filename in *.jpg
do
if [ -d "${filename:0:8}"/"${filename:8:2}" ]; then
mv “$filename” “${filename:0:8}”/”${filename:8:2}”/
else
mkdir -p “${filename:0:8}”/”${filename:8:2}”
mv “$filename” “${filename:0:8}”/”${filename:8:2}”/
fi
done

Hello, today is the day. Our ISP came by and issued me the Firewall Unit i am required to install. It looks similar to our own Firewall, sports 256MB of RAM, has an 80 GB Harddrive from Maxtor, but only two ethernet Ports. After it will be installed, i will write more about how it works. Maybe its not such a bad thing after all, just a useless one. Using my own Firewall i was more than happy. Now i have a Firewall after my Firewall. Well, fine.

More to come…
Got a new iPhone yesterday, with 1.1.4 Firmware. Works nice, though if you dare to change the SSH root Password from apline to something more secret using the inbuilt passwd command, you are in for a headache. Using the passwd command will send your iPhone into an endless crashing Loop, which i havent managed to get out of or fix except for going trough a restore procedure. If you do want to change you r root password though, simply open up your shell on any computer that has perl installed, type this
perl -e 'print crypt("password", "XX")."\n"'
Where you change your password , and the XX to two random characters. These type of Passwords cannot be longer than 8 characters btw. Anyhow, after you ran above command, use the resulting text to replace the crypted password in your /etc/master.passwd file on your iPhone. Login to your iPhone using SSH, or use the Terminal Application, type vi /etc/master.passwd, and look for this line :
root:YOUROUTPUTHERE:0:0::0:0:System Administrator:/var/root:/bin/sh
Replace the content immediately after the root: with the output from that command we used early on. Done, password changed.
Maybe do the same for the mobile User, which is also a line in the same file.
NOTE:
Someone mailed me and stated that the above method did not work for him at all. Quite the opposite, he had to reinstall his Firmware again. Annoying. According to him, the
following snipped to generate the Password Hash worked fine.
openssl passwd -crypt -salt /s myNewPasswd
Personally right now i don’t have another iPhone to try this on, but i think i should still mention his method here.
This Site will contain a lot of things; however it is dedicated to my two absolute favourite Operating Systems, FreeBSD and OpenBSD. While truly not a complete fanatic, a part of my involvment in the Projects means Advocacy.