Archive for October, 2007

Howto: Random E-mail Signature in Evolution

Thursday, October 18th, 2007

I include Latin phrases in my e-mail signature at work. It’s a fun little thing I do just to make people interested.

So I decided to make a signature that would include a random Latin phrase in every e-mail I send. Thankfully, Evolution makes this easy.

First, I make a text file which I call sigquotes.txt , and stash it in my home directory, under a folder for personal items. I put one quote per line.

Next, I have to write a little ditty to grab a random line from that file and output the results. I used PHP for this, but almost anything could have worked. I dump the following into sigrand.php :
<?
$quoteFile = "/home/icanhaslinux/personal/sigquotes.txt";

$fp = fopen($quoteFile, "r");
$content = fread($fp, filesize($quoteFile));
$quotes = explode("\n",$content);
fclose($fp);

srand((double)microtime()*1000000);
$index = (rand(1, sizeof($quotes)) - 1);

echo "________<br>LightningCrash<br>Resident Unix Witchdoctor<br><br>";
echo $quotes[$index] . "<br>";
?>

Easy enough. I had problems getting the php itself to run as a script, so I had to make another short script to launch the PHP file. I put the following into sigrand.sh :

/usr/bin/php5-cgi -q /home/icanhaslinux/personal/sigrand.php

I chmod +x sigrand.sh and go on my way to the next step.

I fire up Evolution, go to Edit->Preferences. I go to Composer Preferences and click on Signatures. Then I click on the “Add Script” button, name it Random Latin, navigate to /home/icanhaslinux/personal, and select sigrand.sh as my signature script.

That part is done. Now to make it default for my outgoing e-mail. From the Preferences page, I click edit on my e-mail account. On this page, I have a drop-down box where I can select my signature for this account. I select Random Latin, of course. I then click OK and Close.

Now, to test it out, just fire up a new e-mail.

Until next time!
-LightningCrash

EDIT:   It’s been requested that I make clear what license this code is issued under. I consider the code snippets on this article to be public domain and not subject to licensing. Use the code in this article as you see fit.

Just for SB @ Microsoft

Tuesday, October 9th, 2007

steveballmershands.jpg

11-02ballmer_lg.jpg

 

You gotta love Fair Use. :)

De-RIAAing my music collection

Friday, October 5th, 2007

I recently decided that I won’t own any music from an artist that is represented by the RIAA. Now, how do I go about De-RIAAing my ripped albums?

RIAA Radar has a website that will let you search for artists, albums, keywords, etc and it will give you information as to whether or not an album was released under the RIAA.

So I did a view-source on their search page and determined that there are only three variables that you need to POST in order to search: searchtype, keyword, and submit.

I can use wget to grab the file, like so:
wget http://www.riaaradar.com/search.asp --post-data "searchtype=ArtistSearch&keyword=Audioslave&submit=Go\!" -O Audioslave

This saves the file as Audioslave. Audioslave IS represented by the RIAA, by the way.

Now, how do I take my ripped albums and compare them to the RIAA Radar site?

(more…)

5 ways to drop yourself reminders/alarms in Linux

Wednesday, October 3rd, 2007

A lot of services on the web offer wake up calls, reminder calls, or just other services meant to drop you an e-mail or phone call at a specific time. You can do many of these things via a Linux box, and maybe save yourself some money in the process.

  1. Send yourself a one-time reminder e-mail about something.
  2. You can do this via the handy ‘at’ command. For instance, if I wanted to shoot myself an e-mail after work reminding me to pick up my laundry from the dry cleaners, I could do the following:
    echo "mail -s 'Get dry cleaning' me@myemailaddress.com < /dev/null" | at 17:45

    I can also send this e-mail to my cell phone, giving me another reminder away from my computer. US AT&T users can send messages to their telephone number @txt.att.net and it will be received as an SMS message on the phone.

  3. Pop up a one-time reminder on your computer about something.
  4. The ‘at’ command comes in handy again. If I want to remind myself to let my dogs in from the back yard, I can simply type:
    echo "DISPLAY=$DISPLAY xmessage Let dogs in!" | at 18:15

    At 6:15, a little message box will pop up telling me to let the dogs in.
    You can also specify times for ‘at’ by using NOW + interval.
    For instance, using
    at "NOW + 30 minutes"

    will give me an execution time of 30 minutes from now. I could use hours, days, or weeks to get whatever effect I wanted. In addition, an e-mail log of everything will be sent to my local e-mail account, detailing what went on.

  5. Alarm Clock with ‘at’
  6. If you need to wake up early one morning, or you want to wake up from a nap, you can use your computer as an alarm clock and play an MP3 for you to wake up to. This one is straightforward enough. You’ll need mpg321 installed to use this, and know the path to the mp3 file you want to play.
    echo "mpg321 ~/Trivium/Rain.mp3" | at 5:30AM

    You’ll have to execute pkill mpg321 in a terminal to make it shut up, though.

  7. Alarm Clock with ‘cron’
  8. Now we’re going to do the same thing, but on every weekday of every month.
    Execute crontab -e and then type in the following:
    30 5 * * 1-5 mpg321 ~/Trivium/Rain.mp3 >/dev/null

    Now, every weekday at 5:30, you’ll get that mp3 blasting out over your speakers. Obviously you’ll need to specify your own MP3 file. You’ll also need to execute pkill mpg321 to make this one shut up. Your spouse may not like this idea, but assure your spouse that it will make you wake up more easily.

  9. Alarm Clock with KAlarm
  10. You’ll need to install KAlarm for this one. KAlarm will let you run XWindows applications (or even command line apps) via a cron-like process. It can also send e-mails and pop up messages. Check out their documentation here.
    You can schedule MP3s with XMMS and Totem much in the same way as you can mpg321.
    xmms ~/Trivium/Rain.mp3
    totem ~/Trivium/Rain.mp3

    You can set up Kalarm to run these programs and blast out your music for a specified time. If you haven’t killed the application within that set time period, Kalarm can kill it for you. Which is handy when you’re not home and you have heavy metal blasting through your 7.1 Surround Sound speakers at 5:30 in the morning for your neighbors to hear. Eviction isn’t high on anybody’s priorities list.

Did I miss anything? Leave it in the comments section.
Until next time!
-LightningCrash

Amazon S3 Backups

Monday, October 1st, 2007

I really like the affordability of Amazon’s S3 service. I don’t need to back up a lot of data, but I do need it available anywhere I have an internet connection. I also need it to be automated. S3 lets me have those features.

I back up my personal e-mail server, my home desktop, and my MythTV box to Amazon’s S3 service. I run weekly full backups of select directories on my desktop, and then incrementals throughout the week. My MythTV box backs up its database on its own, so I just tarball the output and dump it to a folder on my desktop machine, which gets put on S3 when the backup job runs. My mail server runs full backups of select directories every night.

I used some bits and pieces from Paul Stamatiou’s article on S3 backups. You can read that article here.

I added in some bits and pieces for using an include/exclude file, and modified it to run incrementals on my desktop. I also got to use mktemp to do some of my bidding, which was very handy.

All told, my Amazon S3 bill for last month was $1.48 for ~8GB of transfer in, and ~3.7 storage GB/mo. I pair down my stored files weekly to meet some retention guidelines, so that contributed some to my low bill.

But all in all, I’m VERY impressed with S3. I definitely got my $1.48 worth! :)

All quiet on the home front

Monday, October 1st, 2007

I’ve been a bit busy and all with certifications training, so I haven’t had time to publish much.

However, I did find a nicely written article a few days ago that I wanted to share. Without further ado, go read “BSD For Linux Users.”

I’m working on some rather large articles for your perusal, so it won’t be long before there is some activity here.

Until next time!

-LightningCrash