adrian is rad


sms alert for football (NFL) scores

Filed under: — adrian @ 11:35 pm

The other day, I was thinking it’d be cool to have sms alerts sent to my phone whenever the score changes in the Steelers game. I noticed that the NFL scores page has some peculiarities in their structure that would make it somewhat easy to pick out the scores.

There are people who you can pay to do this. (Or, I discovered today, there are sort of sketchy places that will do it for “free.”) But let’s say you don’t want to pay. And let’s say that you, like me:

  • have unlimited (or plenty of) sms’s
  • have a server or access to a server
  • are slightly obessive your team
  • love being a geek

So I wrote a perl script to do it (with some help from jesse and a lot of help from andyl). I’ve put it online here. Grab it if you want it. I ran it with a cron job which checked the score every two minutes during today’s Atlanta-New Orleans game:

[insert crappy picture of sms]

What you’ll need to do to make it work:

  1. download the file
  2. get WWW:Mechanize and HTML::Tree::Builder perl modules. if you’re running debian, you can type ‘apt-get install libwww-mechanize-perl’ and ‘apt-get install libhtml-tree-perl’ respectively.
  3. open Score:
    1. find ‘mail 0123456789\’ and replace it with your phone number and email gateway. (here are two lists of email gateways. So if you have sprint and your phone number is 987-654-3210 then your put ‘mail 9876543210\’. It’s important you \@ your @ sign or it won’t work.
    2. if you want the scores of a different team than the Steelers, find the two instances of ‘Pittsburgh’ in the file and replace them with your town’s name. (Check to check how they write it).
  4. save the file
  5. open your crontab file (in /etc/crontab) and add the following line:
    */2 9-21 * * 00 root perl /home/directorypath/Score >& /dev/null
    where /home/directorypath is whereever you’ve put the Score file. This will check the score every 2 minutes (*/2) between 9am and 9pm (9-21) on sundays (00). You can adjust these parameters if you’re on the east coast (adjust the times) or if your team is playing on a non-Sunday. 1 would be a Monday, etc.

It emails you the team names, their scores and the time (2nd Qtr, 2:54, for example).

It worked very nearly flawless during tonight’s game. I made one change so that when the game ends it’ll sms you the score and say it’s “Final” as well as smsing all the score changes. It does send one unnecessary sms when things are resetting the first time the cron job runs. You could probably figure out how to make it not do that.

I’m just putting this code out there. Use it if you like. I’m not really in a position to offer any warranties or support on it. I’m putting this out there under the Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.

Pittsburgh friends, I can add you to my script if you want to get Steelers alerts too. Just let me know.

page mill ride

Filed under: — adrian @ 8:05 pm

I did Page Mill Rd, one of the hardest hills around here, for the first time on Saturday (coincidentally so did Palo Alto Cyclist). The sort of triumvarite of hills around here are Page Mill, Old la Honda and King’s Mountain.

The hill part of Page Mill is 7.2 miles long and 2400 feet of elevation. It starts out fairly shallow, like the lower part of King’s Mountain (for about three miles). Then it hits some steep sections:
Page Mill Road (at Los Trancos parking lot 19.25%
Page Mill Road (at Moody Road) 14%
Page Mill Road (lower view area) 15.50%
Page Mill Road (long, steep section) 15.5 – 17

The long, steep section they’re talking about hits right around Gate 3 of the Foothill Park and is about half a mile of steep. It hurts a lot. Then it levels out and even goes down a little bit before the 100 or 200 yard section right before the Los Trancos parking lot. By this point my legs were pretty tired so even though it leveled out a bunch, it was still fairly strenuous.

I’ve had a pretty good riding season. I started out never having gone up Old la Honda or King’s Mountain non-stop. I set some cycling goals through the summer and I did pretty well:

  • Old la Honda non-stop
  • King’s Mountain non-stop
  • Old la Honda in under 30 minutes (and under 29 minutes)
  • Old la Honda and King’s Mountain back to back
  • Tahoe Century
  • biking to SF
  • coast ride
  • Page Mill

My total mileage for this year (from January through now) is something like 1400 miles.

Powered by WordPress