Wednesday, March 16, 2011

Weather Threshold Monitoring Script

Handy script for spring:

#!/usr/bin/perl
#
# Weather Threshold
# Watches for a certain temperature outside, and sends email when met
# Set variable $thresh below to what you want to watch for
# Meant to be run by Cron
# Example Cron Entries:
# 55 8 * * * /bin/rm -f /tmp/tempthresh-met
# */15 9-14 * * * /home/arthur/bin/tempthresh.pl
# 10 14 * * * /bin/rm -f /tmp/tempthresh-met

use Weather::Google;

# set temp threshold
$thresh = 50;

if ( -w "/tmp/tempthresh-met" )
{
        # print "Temp Threshold met, exiting\n";
        exit 0;
}

my $gw;

$gw = new Weather::Google(48423); # Zip code
$gw->language('en');

my $temp_f = $gw->current_conditions('temp_f');
# print "It is $temp_f F degrees\n";

if ( $temp_f > $thresh )
        system("echo | mail -s \"tempthresh.pl reports: temp over $thresh F\" youremail\@domain.com &> /dev/null");
        system("touch /tmp/tempthresh-met");
}

Friday, February 12, 2010

GDM 2 Themes and Backgrounds

Learned tonight that GDM 2 can be adjusted by running:

gksu -u gdm dbus-launch gnome-appearance-properties

You can set the theme, background, etc just like the appearance
properties in regular GNOME.

Tuesday, August 25, 2009

Firefox 3.5 on Ubuntu

To install or upgrade to Firefox 3.5:

sudo sh -c "echo 'deb http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main' >> /etc/apt/sources.list"
sudo sh -c "echo 'deb-src http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu jaunty main' >> /etc/apt/sources.list"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247510BE
sudo apt-get update && sudo apt-get install firefox-3.5

Tuesday, August 18, 2009

Sending Tweet's From the Command Line

Saw tweeted by commandlinefu.com that you can use Curl to send tweets! I've been doing this an aweful lot lately. When I'm working, and need to send a quick tweet, I just use my handy little sendtweet.sh script.

Here is my "sendtweet.sh" script:
------------------------------------------------------

#!/bin/bash
if [ ! $1 ]
then
echo "Send Tweet. Usage:"
echo "$0 message"
echo
echo "This $0 script sends twitter status updates"
echo
echo "Make sure you escape anything but alphanumerics"
echo
exit
fi

curl -u twitter_username:twitter_password -d status="$*" http://twitter.com/statuses/update.xml
------------------------------------------------------

The if look is just to prevent me from doing anything stupid. You have to escape anything but alphanumerics, so usage is like:

sendtweet.sh Cool\, I\'m sending tweets from bash\!\!\!

Thought you all would enjoy that ;)

Sunday, August 16, 2009

Syndaemon Touchpads

For those of you who have laptops and have that annoying problem of accidentially hitting the touchpad while working, I stumbled across this little blog post while surfing the #ubuntu hashtag on Twitter:

http://david.wonderly.com/archives/29

basically its about syndaemon, which can monitor for keyboard activity, and disable the touchpad while until your done typing.

Good bye annoying accidential touches!

Wednesday, August 12, 2009

Chromium on Ubuntu

Chromium has gotten pretty useful now. Here's how I installed it from the Ubuntu PPA:

================================
vim /etc/apt/sources.list
----- add -----
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
----- add -----
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E5E17B5
sudo apt-get update
sudo apt-get install chromium-browser
================================

Start with:

chromium-browser --enable-plugins

to get Flash support, which is a little buggy. Otherwise, its a pretty nice browser, and a decent option for Lean installs

Thursday, August 6, 2009

Force upgrade of PEAR

Recently I received this error while trying to install a package in PEAR:

# pear install HTTP_Request
HTTP error, got response: HTTP/1.1 410 Gone
Didn't receive 200 OK from remote server. (HTTP/1.1 410 Gone)

The solution, was to upgrade PEAR:

pear upgrade --force http://pear.php.net/get/Archive_Tar http://pear.php.net/get/XML_Parser http://pear.php.net/get/Console_Getopt-1.2.2
pear upgrade --force http://pear.php.net/get/PEAR-1.4.3.tar
( OR: pear upgrade --force http://pear.php.net/get/PEAR-1.3.3 _IF_ your existing older than 1.3.3)