A simple Python raytracer that supports spheres with configurable "material" properties (base color and a bunch of light coefficients). To generate a raytraced image of the pre-defined scene, run: python and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres


I found the following resources extremely helpful:

View microtime.c
#include <sys/time.h>
* Returns the current time in microseconds.
long getMicrotime(){
struct timeval currentTime;
gettimeofday(&currentTime, NULL);
return currentTime.tv_sec * (int)1e6 + currentTime.tv_usec;

adding a map to any website

Rendering a web-map without resorting to Google Maps is surprisingly trivial. The following example uses the incredible open-source Leaflet library and map tiles provided by OpenStreetMap. Check it out on rawgit.



bpython+ is a thin wrapper around the bpython interpreter, which allows the user to specify whether it should be executed with version 2 or 3 of the Python interpreter; the implementation is practically identical to that of pylint+.


You must have:

  • python2 in your $PATH
  • python3 in your $PATH


Developers commonly work on both Python 2 and 3 codebases, so it's desirable to configure the pylint utility to execute against a specific version of the language. Problematically, it relies on the system-wide Python interpreter (for abstract syntax trees, etc.), so simply passing in a flag, like --use-version 3, wouldn't suffice; the solution is to write a thin wrapper script around pylint which executes it with the proper interpreter.


You must have:

  • python2 in your $PATH

compile full Vim

The default Vim installed on most Linux distros lacks a number of vital features, like xterm_clipboard (allows copy-and-pasting to the system clipboard) and python (on which certain plugins rely). The shell script removes the currently installed Vim and compiles a full-featured version; it's based entirely off Valloric's YouCompleteMe walkthrough, which it bundles into a simple script for convenience. Vim will be compiled with the following feature flags:

  • --with-features=huge
  • --enable-multibyte

import quattroshapes into PostgreSQL

The shell-script will import all Quattroshapes shapefiles into a PostgreSQL database. The process has some gotchas and is generally painful to do manually. Before running the script, ensure that you are logged in as a user with permissions to access/write to PostgreSQL. Then:


Note that the script will create a Postgres table quattroshapes, and download all Quattroshapes shapefiles into