The train is departing in…

It has been a crazy few months for me. I moved half-way across the country to start my new job at reddit. The dust is just now settling, and I finally have a permanent residence nailed down. I should be back to blogging more regularly soon.

One of the benefits of my relocation is that I finally have a viable public transportation option for my commute, namely BART. I have been trying to figure out the train schedule, but I quickly learned the BART timetable is really more of an ideal than concrete fact. The one resource which has been useful is the real time departure info available on the BART website.

Being the typical admin that I am, I decided to replace the act of visiting this site each morning with a very small shell script which audibly informs me of the impending train departures from my local station. In a further demonstration of standard sysadmin behaviour, I threw it together in about five minutes and it is ugly as sin… but it works.

(Note to prospective stalkers, I changed the link to hide my true departing station)

curl '' | \
grep SFO | \
perl -ne '`espeak "The train is departing in "`; while ($x = m/(\d+) min/g) { `espeak "$1 minutes,"` }'

Apparently BART has a full-fledged API for pulling this type of stuff down, but this works for now.

I’ll leave the details of how it works as an exercise for the reader. It should work on any of the stations listed on the departing info page.

Happy trails!

Share and Enjoy:
  • StumbleUpon
  • Facebook
  • Twitter
  • Reddit
The train is departing in…

2 thoughts on “The train is departing in…

Leave a Reply

Your email address will not be published.