“Tip me that output quickly, would you?”

Jonathan recently wrote Codetip, a pastebin based on Twisted.Web with some neat client-side features and integrating server-side JS as well.

There’s a demo one running at http://pb.vuze.la/

Short of the setup doc in the readme, there’s some further work you get to do when installing this on something like Debian Squeeze. Here’s a quick rundown from my shell history:

 1237  aptitude -t wheezy install python-pip
 1242  aptitude -t wheezy install virtualenvwrapper
 1252  aptitude -t wheezy install python-virtualenv
 1257  aptitude -t wheezy install python-sqlite python-pysqlite2

All of those mostly because of versioning. Node.js was also installed previously (for Brewer.js), so npm was around as well, at the sid package version level.

It was set up in a separate user account, with a virtualenv to avoid crapping all over the system. For those who don’t know, a virtualenv is used to make a little jail for python things to get installed into. This way you can have a different local version of something to what’s installed globally (globally meaning system level). Turns out this makes life a bit more painful:

Drop this into .zshenv (or the appropriate equivalent for your shell):

# virtualenv
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--system-site-packages'
export VIRTUALENVWRAPPER_LOG_DIR=$WORKON_HOME
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true

And then run:

git clone https://github.com/jonathanj/Codetip.git
mkvirtualenv Codetip
activate Codetip
pip install Twisted; pip install Epsilon; pip install Axiom; ln -s =nodejs $(VIRTUAL_ENV)/bin/node
npm install brewer
cd Codetip
./node_modules/brewer/bin/brake install
./node_modules/brewer/bin/brake all
twistd -no-web --notracebacks --class=Codetip.resource.RootResource

The virtualenvwrapper package provides ‘mkvirtualenv’ amongst other things, use `source /etc/bash_completion.d/virtualenvwrapper` to get the hooks. This shellscript also works in zsh.

And that’s it, a working Codetip instance.