Linux notes | my old linux notes | HTPC notes | smovs.dk | nk-h.dk | Write a comment
My personal notes collected while messing with Ubuntu 6.06 (server) on my Mini-itx M10000 Nehemiah based server (with the OS running of a 2GB CF card, and a Hauppauge PVR-350 for experimental reasons), Ubuntu 7.04 on my IBM ThinkPad T23 and Ubuntu 7.10 on my T40p.
All entries here:
2008-12-15 03:49:41
Turn the display off (and on) remotely
2008-10-01 01:47:53
WD My Book Studio Edition 1TB
2008-07-25 17:37:13
Newcs cardserver
2008-07-19 18:12:09
Batch rename
2008-07-04 20:29:31
ThinkLight Gmail checker bash script
2008-06-28 23:54:42
Pinnacle DVB-T nano stick (PCTV 73e)
2008-06-21 19:21:20
Play video as ASCII in the console with VLC and mplayer
2008-04-30 19:35:23
Quite random short notes
2008-04-27 22:03:04
Drawing graphs with PHP
2008-04-20 19:01:48
Eggdrop IRC bot
2007-12-30 23:40:13
Apple Bluetooth Keyboard in Ubuntu
2007-12-30 23:28:50
Schedule a recording from the Hauppauge PVR-350
2007-12-30 23:23:50
Network streaming from a Hauppauge PVR-350
2007-12-30 23:09:12
System backup
2007-12-30 23:05:01
Apache2 - Restart
2007-12-30 23:03:41
Apache2 - Reverse Proxy
2007-12-30 22:03:39
Select input on Hauppauge PVR-350
2007-12-30 22:03:39
Capture pictures / screen shots from Hauppauge PVR-350
2007-12-30 21:36:13
Video playback through the tv-out on Hauppauge PVR-150

ThinkLight Gmail checker bash script
This is a simple script that checks a Gmail account, and turns on the ThinkLight on a ThinkPad laptop when there're unread emails.

The script includes the email address and login in unencrypted form, so it might be advisable to come up with a neater solution :o) But I hope this can be of some inspiration:

#!/bin/bash
# We'll turn on the ThinkLight if there're unread emails

# checking for new emails
rm /home/username/bash/tmp/atom
wget --no-check-certificate -q -P/home/username/bash/tmp/ https://gmail-username:gmail-password@mail.google.com/mail/feed/atom
email=`perl -ne 'while(/author/g){++$count}; print "$count\n"' /home/username/bash/tmp/atom`
echo $email
if [ -n "$email" ]; then
email=$email
echo "There are new emails"
echo on | sudo tee /proc/acpi/ibm/light
else
echo "There are no new emails"
email=0
echo off | sudo tee /proc/acpi/ibm/light
fi


The script uses the directory /home/username/bash/tmp/ to store the file downloaded from Gmail, so that dir has to exist.

If you save the script as checkmail and make it executable (with chmod 777 checkmail), you'll be able to make the script run in the background with:

sudo watch --interval=300 ./checkmail &> /dev/null &

2008-07-04 20:29:31