Query Google Analytics API with a service account in Python

I recently needed to display a visitor counter on a website by some client’s weird demand. Maybe the 90s are coming back. Anyway, I thought it makes sense to query Google Analytics directly, but Google’s API example were not really helping. After some digging around, I finally found a solution. You’ll need oauth2client and google-api-python-client for it to work. Then follow these instructions on Google Developers to create a service account that only has access to the API without the need for a human to request some oauth token. It will give you a private key to work with.

Here’s a Quick Way to make code look nicer in Firefox

I use Droid Sans Mono as my font for coding and in Putty and nearly everywhere. You can read and download it over at damieng.com.

If you want code and fixed-width text to appear nice in Firefox, what’s a better idea than using Droid Sans Mono there, too?

Go to Options > Content. Under Fonts & Colors click Advanced and choose Droid Sans Mono as monospaced font. It’s as easy as that. It will now affect every fixed-width text that is not formatted by CSS or something else. It will even change fonts in Firebug. I like it, it looks beautiful!