May 4, 2013

Saturday afternoon webcam 
noodling

April 13, 2013

IMG_20130401_155340.jpg

http://en.wikipedia.org/wiki/Arrow_of_time

The Moving Finger writes; and, having writ,

Moves on: nor all thy Piety nor Wit

Shall lure it back to cancel half a Line,

Nor all thy Tears wash out a Word of it.

  • Omar Khayyám

March 18, 2013

sunset-newhouse.jpg

These days I am using Bitbucket for the git repository hosting and task management on my commercial projects. One thing I often need to do is fetch a list of current tasks so that I can update a client with what is on our current agenda for them, get feedback about priorities etc. Here's a short Python script I hacked together to do that based on some other public domain scripts I found out there:

import base64
import cookielib
import urllib2
import json

class API:
    api_url = 'http://api.bitbucket.org/1.0/'

    def __init__(self, username, password, proxy=None):
        encodedstring = base64.encodestring("%s:%s" % (username, password))[:-1]
        self._auth = "Basic %s" % encodedstring
        self._opener = self._create_opener(proxy)

    def _create_opener(self, proxy=None):
        cj = cookielib.LWPCookieJar()
        cookie_handler = urllib2.HTTPCookieProcessor(cj)
        if proxy:
            proxy_handler = urllib2.ProxyHandler(proxy)
            opener = urllib2.build_opener(cookie_handler, proxy_handler)
        else:
            opener = urllib2.build_opener(cookie_handler)
        return opener

    def get_issues(self, username, repository, arguments):
        query_url = self.api_url + 'repositories/%s/%s/issues/' % (username, repository)
        if arguments:
            query_url += "?" + "&".join(["=".join(a) for a in arguments])
        try:
            req = urllib2.Request(query_url, None, {"Authorization": self._auth})
            handler = self._opener.open(req)
        except urllib2.HTTPError, e:
            print e.headers
            raise e
        return json.load(handler)

if __name__ == "__main__":
    import sys
    if len(sys.argv) < 5:
        print "Usage: %s username password baseuser repository" % (sys.argv[0],)
    else:
        result = API(sys.argv[1], sys.argv[2]).get_issues(sys.argv[3], sys.argv[4], (("status", "new"), ("status", "open"), ("limit", "50")))
        for p in result["issues"]:
            print " *%s %s" % (p.has_key("responsible") and "**" or "", p["title"])
            #print p["content"]
            print

Run it to get a usage message.

I secretly wish that bzr had won the distributed version control wars because of its superior user interface, but these days I am resigned to using git because pretty much everybody I have to inter-operate with is using it. It's not that bad.

March 14, 2013

deviator.jpg

Deviator, the smartphone based ARG-like artwork by pvi collective that I worked on is showing at PICA in Perth, Western Australia next week after it's successful tour of Glasgow last year.

Apparently tickets are selling fast so get in there quick!

March 8, 2013

IMG_20130308_091255.jpg

-- Sent from my Android phone with K-9 Mail. Please excuse my brevity.