Tuesday, 2 March 2010

concerto + twitter

During the trials of concerto at CERN, I wanted to make the text fields a bit more dynamic like say following a specific twitter feed.

This would (ideally) simply consist of a DB entry with type=twitter, value=name of person. In the Real World however I got round this by hacking up a simple python script that connects to the DB and does a simple UPDATE of an existing text/plain entry via cron.

posted below incase others find it useful:


# Script to pull twitter feeds for cern / lhcstatus
import twitter
import MySQLdb

conn = MySQLdb.connect (host = "...", user = "...", passwd = "...", db = "...")
api = twitter.Api()
feeds = { 'cern': 25, 'lhcstatus': 28 }
for f in feeds:
tweets = api.GetUserTimeline(f,count=1)
for tweet in tweets:
sql = 'UPDATE content SET CONTENT = "%s" WHERE id = %s' % (tweet.GetText(),feeds[f])
cursor = conn.cursor ()
cursor.close ()
conn.close ()

yes its hacky, but hey, called from cron regularly it works :-)

Monday, 1 March 2010

They're following me!

As you know, I've been 'tweeting' the Status of the LHC from the 'Page1 comments' field. Decided to knock up a quick script to plot the number of followers over time, and lo:

Plotting Lustre MDS stats

At $dayjob we have several large filesystems - for example our /scratch system has 3.1 PB of space using over 1000 HDDs. Although each vendo...