Short Links

Posts around the web that I found interesting today:MathWorld’s page on Pi: Always fascinating to read crazy facts about mathematical constants.Ignite: It’s Really Just a Series of Tubes: An interesting 5 minute talk on the intracity pneumatic tubes used for communication.Upgrading to 9.04 and Ext4 Remotely: Don’t do this, but this will be useful for me in the coming weeks.New Filing: DOJ claims immunity in wiretapping case: I’m sad that the Obama DOJ not only embraces the legality of domestic wiretapping, but they’ve produced a new legal doctrine that basically says the president is above the law. Glenn Greenwald gives a detailed analysis.Co-founder of Starbucks exclaims his love for his French press: I have mixed feelings about mine.Super-expensive bike store in TriBeCa, sales down: Leah and I walked by the other day; she asked me why I didn’t buy my bike here. This article explains why.Self-appointed traffic cop in Washingon Square: Give me 23 years and I might be this guy.Water Tanks in NYC: It’s nice to know a bit more about the water tanks on buildings in my town.

Simple XSLT and Delicious API

I decided I wanted to take five minutes today to implement a simple idea I’ve had for a long time. When I get home, I typically eat dinner while reading news in my RSS reader and I’ve found less and less time to write my own posts. I simply wanted to be able to bookmark the things I found interesting and have them automatically appear as a weblog entry.

Part one was getting the data from Delicious, which is the obvious choice for bookmarking. They make it really easy to get all bookmarks made on the last day of activity with a given tag with their posts/get function. To get all bookmarks I made today with a tag of “viewed”, I simply ran:

$ curl ‘https://minusnine:password@api.del.icio.us/v1/posts/get?dt=2009-04-07&tag=viewed' > todays.xml

which saves an XML form of the posts.

Transforming the XML into a list is a trivial task but I saw two approaches: sed would do nicely for the crufty old sysadmin in me, but XSLT satisfies the young whippersnapper in me.

The XSLT is very simple and elegant.

Combining these with xsltproc:

$ xsltproc posts.xsl todays.xml

yields a cut-and-pastable post. The next step is to pipeline these (also trivial) and upload it to my Wordpress installation.