Find all email that a user sent via postfix mail.log

I needed to find all the email that a user sent with only the postfix mail.log. This simple script does that. There is probably an easier way :-)

#!/bin/bash USERNAME=$1 for i in `grep -A2 $USERNAME mail.log | \
grep message-id | cut -d'<' -f2 | cut -d'>' -f1`; \
do grep "$i" /var/log/mail.log | grep "to=" | awk '{ print $7 }' | \
cut -d'<' -f2 | cut -d'>' -f1; done | sort | uniq -c

 

How to get CallerID via http and CDR records working with asterisknow 1.7

We've been using Trixbox for many years as our PABX at iseek computing, but I wasn't happy that it was moving forward nicely as a project, so last time we rebuilt the PABX using AsteriskNOW instead.

It all worked fine, slightly easier that Trixbox perhaps, and no weird forum registration required, and its pretty clean with FreePABX being the main interface.

Wallpaper scaling

I had a whole bunch of wallpapers lying around, but they were all different sizes, which really looks screwy on a dual screen setup.

The attached perl script reads through all images in $HOME/Pictures.original/ and creates new copies in $HOME/Pictures/ as the specified image size in the file.

By setting the image size to exactly the size of one of the dual screen monitors (this assumes identical resolutions on both screens), and running the script, the backgrounds then work nicely.

WD Raptor failure ;-(

Got into the office this morning, and the core vmware host server is down, the mirror for the boot drive barfed at around 60% when synchronising after a power failure.

Oh well, thats what mirroring is for after all, disconnected it and rebooted. nothing. no Grub nada. After running around getting a boot disk organised, making sure grub was installed etc, it STILL didn't work.

WTF!

After a bit more hair tearing, I realised the BIOS had promoted the wrong drive when i removed the dud one. Doh. Of course the data drives dont have grub on them at all.

Web filtering

Recently on a mailing list, somone asked about setting up web filtering for children.

While nothing beats supervision, som fairly effective and simple webfiltering can be setup on a linux based pc by combining squid with the jesred redirector.

Basically, create the jesred files as follows in /etc/squid and add the lines from the bottom file into your squid.conf. This plus std tranparent proxying does quite a good job. Yes, I know theres very easy ways around it, but by the time the kids figure that out, you're not going to stop them anymore ;-)