Dynamic email signature for your mail clients

Actually it is not that dynamic. Basically I just want to embed the list of my 3 latest blog postings in all my outgoing mails, just below my signature. So what I meant by dynamic is that the text file which is holding the signature will get updated from time to time via a cron-job and a simple script.

The script will read the RSS/Atom feed from my blog and capture the title & url of three latest postings and pump them into my signature file. I use Python script and the marvelous Universal Feed Parser.

For most of linux system python would already been installed by default. However you might need to install Universal Feed Parser (python-feedparser) in order for the script to work.

In my Gentoo machine
emerge -av dev-python/feedparser

For Fedora Users
yum install python-feedparser

For Ubuntu users
apt-get install python-feedparser

The phyton code (take note that I’m new to python. If you find that the script is not appropriate please do advise me)


#!/usr/bin/python

import feedparser

#the signature file (output)
filename = '/path/to/your/home/folder/.signature1'

#numbers of items to be displayed
num = 3

#feed address
feedurl = "http://feeds.feedburner.com/RidingLinux"

#your signature. Change accordingly
text = """Regards 
Your Name
Your Company
Address
Telephone

My latest BLOG posts:

"""

d = feedparser.parse(feedurl)
if d.feed.has_key('title') :
	file = open(filename, 'w')
	for i in range (num) :
		text = text + d['entries'][i]['title']+"\n"+d['entries'][i]['link']+"\n\n"
	file.write(text)
	file.close()

Save the above script in your home folder (eg: /home/yourname/signature-update.py) and test it out.
Once everything is ok, add a cron-job for it to be executed in schedule.

Example (if you are using ‘crontab -e’) command

0,30 * * * * python /home/yourname/signature-update.py >/dev/null 2>&1

This will execute the script every half and hour.

Sample generated file

Regards
My Name
My Company
My Address
My Telephone Number

My latest BLOG posts:

Vuurmuur firewall management interface for Linux Iptables
http://www.ridinglinux.org/2008/06/23/vuurmuur-firewall-management-interface-for-linux-iptables/

Food Strainer – Your Wifi reception booster!
http://www.ridinglinux.org/2008/06/15/food-strainer-your-wifi-reception-booster/

Simple port forwarding with Iptables in linux
http://www.ridinglinux.org/2008/05/21/simple-port-forwarding-with-iptables-in-linux/

Now I can simply point my mail client (Evolution, KMail, Claws-Mail or Thunderbird) to use the above file as my signature.

Vuurmuur firewall management interface for Linux Iptables

In my previous post regarding iptables, I’ve mention about an iptables management tool called Vuurmuur (http://www.vuurmuur.org/). Most people have probably heard about FireStarter, KMyFirewall and ShoreWall. Basically Vuurmuur serves the same purpose, which is providing easy way to manipulate iptables rules for users to manage their firewall without having to worry about all those complex iptables commands. Those tools give us the ability to play around with iptables either by using graphical interface or adjusting configuration files.

Vuurmuur Rules List

The thing I like about vuurmuur is that it uses Ncurses GUI interface, meaning that you can manage it via a terminal console or SSH. The drawback of using tools such as FireStarter, KmyFirewall is you need to have a graphical desktop, thus making it hard to manage them remotely especially via slow internet connection or if you are using Windows machine to do the administration process. While some other tools provide web-based management interface such as Smoothwall (via Webmin) or a dedicated firewall box like IpCop and Astaro Internet Security, allowing those web interface to the internet wouldn’t be a recommended practice. Furthermore, the web interface provided by Astaro Internet Security is too slow for a remote user.

So if you need a very light (and yet POWERFUL) solution suitable for frequent remote administration, its either you use the pure command line iptables command, or using config file based tool such as ShoreWall, or lastly if you really need non web-based GUI then Vuurmuur would be an ideal answer. You can simply SSH from anywhere (provided that you allow SSH remotely) or by using Windows SSH interface called Putty.

Apart form that, I am also pleased with it’s ability to do other things such as providing realtime log viewer, traffic shaping, traffic volume monitoring and lots more. Combine those things with Iptraf, then you will get hooked if front of your ‘blue screen’ for the whole day, even worse than watching blue film. 😉

Vuurmuur realtime log viewer

Food Strainer – Your Wifi reception booster!

I recently moved to a new house. Everything went well apart from my telephone & internet line migration. As for now, the telco/ISP (the Malaysian TMNet aka TMNut) cannot do the migration process due to technical problems. Been whacking their customer service almost everyday but they seem to have a trick of looping our reports and complains into some kind of black hole. They responded with varies of reasons such as no ports available, faulty line ect..etc.. but none of them seems to make any sense.

I desperately need internet connection at home and luckily a neighbor who are a broadband subscriber willing to share his internet connection with me via Wifi. He already have a wireless AP installed at his home for personal use.

So I plugged in my USB wifi adapter and manage to connect to his AP.

My USB wifi adapter

But the signal is very sluggish which is expected due to the distance between our house. The link quality barely archive 50% and I got frequent disconnection.

Wifi before food strainer

Fortunately a few months back I’ve stumbled upon some funny trick of using food strainer to boost wireless signal. So this is the most suitable time try it out.

I bought myself a new food strainer for RM11.00 and I cut a little hole just about the size of my USB wifi body.

My New Food Strainer

Put the device through the hole

Wifi inside food strainer

Wifi inside food strainer 2

And… PRESTO!!!

Wifi after food strainer

Neat (ugly) huh… But it surely works. My connection is now very stable.

My desktop show off ! (pardon my old hardwares. I’m a cheap geek..)

My powerful desktop

***I’m now thinking of permanently unsubscribe my TmNut telephone/internet line 😉