r _Web.log

tag: code


A-Z.js

Quell the ceaseless anguish of unordered sequences with A-Z.js, a Javascript bookmarklet to immediately sort any webpage into alphabetical order.

ubuweb alphabeticized

The source code is also available on github: A-Z.js

Twitter Punctuation Statistics

Meet @textstats, a twitter bot whose only goal in life is to analyse your punctuation habits.

Tweet "@textstats punctuation" for your percentile scores as regards how frequently you use commas, semicolons, and so forth. It transpires that I use more commas that 93% of the English-speaking population of Twitter, which, frankly, isn't too surprising.

github migration

Some new appearances on github/ideoforms:

tweetarchive: Archive your Twitter feed to CSV

K https://github.com/ideoforms/tweetarchive

I've long wanted a method of exporting Twitter posts to a text-based format -- partly for the joy associated with being able to access my feed with standard text tools (twitter grep, anyone?), and partly for the peace of mind that's difficult to associate with a third-party content host. Their API also provides a limit of 3200 historical tweets per timeline, meaning that, eventually, your past posts will be inaccessible.

So, in a spare moment, I created tweetarchive, a lightweight Python-based tool to export complete timelines in CSV.

Features:

  • uses the tweepy library with oauth for protected accounts
  • only archives tweets created since your previous export
  • writes CSV output with user-specified format - so select what fields you'd like to archive
  • uses time delays to avoid hitting load throttling
  • client-side, meaning no need to give third-party apps access to your auth tokens

Download it here (requires git).

Building pyPortMIDI on Snow Leopard x86_64

I don't make a habit of posting compilation gotchas, but this one was a phenomenally unpleasant time drain. Looking to interface python with MIDI on Snow Leopard, I came across pyPortMIDI, based on part of PortMedia.

Compilation seemed OK, following these hints (also found in pm_python/hints.txt in the portmidi dist), but running the pyPortMIDI test.py script returned the following:

Traceback (most recent call last):
File "test.py", line 11, in
import pypm
ImportError: dlopen(/Library/Python/2.6/site-packages/pypm.so, 2): Symbol not found: _Pt_Time
Referenced from: /Library/Python/2.6/site-packages/pypm.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/pypm.so

Following some excrutiating exploration with dtrace and nm, it transpired that it boiled down to an architecture issue: according to the portmidi xcode build file, /usr/local/lib/libportmidi.dylib was compiled as i386/ppc, but my system is 64-bit.

Solution:
* Open the .xcodeproj file in XCode, change the .dylib Target arch to x86_64, rebuild and install over the existing /usr/local/lib/libportmidi.dylib
* Clean up the pyPortMIDI build, rebuild and reinstall

Now working without a hitch.

Graph paper generator

K http://www.erase.net/projects/graph-paper/

What's better than graph paper? Of course, it's a tool to grow your own printable graph paper, sufficiently configurable to cater for the wildly divergent graph-paper needs of our times.

This Processing sketch (PDE) will generate single-weight, multi-weight and cross-grid graph paper in PDF format, with configurable weights and colours, support for metric and imperial measures, and control over margins and paper sizing. Unsupported, but should be simple to modify.

graph paper

AtomSwarm source now available

K http://www.erase.net/projects/atomswarm/

Screenshot After months of good intentions being ousted by other priorities, I'm pleased to have finally found the time to finish cleaning up and documenting the core classes of AtomSwarm, a Processing-based framework for musical improvisation based on swarm behaviours. It's perhaps not the cleanest set of source in the world, but provides a useful basis for other swarm work and contains information on the genetic and metabolic constructs that co-determine the swarm's behaviours.