Skip to content

Instantly share code, notes, and snippets.

@sevko
sevko / README.md
Created September 3, 2015 16:47
simple Python raytracer

raytracer

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 raytracer.py and open image.ppm with a PPM-compatible viewer (eog works fine on Linux):

raytraced spheres

acknowledgements

I found the following resources extremely helpful:

@sevko
sevko / README.md
Last active August 29, 2015 14:16
How to add a map to any webpage without Google Maps.

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.

@sevko
sevko / README.md
Last active December 21, 2021 14:18
Parallel versions of bpython for Python 2 and 3.

bpython+

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+.

requirements

You must have:

  • python2 in your $PATH
  • python3 in your $PATH
@sevko
sevko / README.md
Last active November 3, 2021 04:59
Parallel versions of pylint for Python 2 and 3.

pylint+

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.

requirements

You must have:

  • python2 in your $PATH
@sevko
sevko / README.md
Last active January 24, 2024 19:25
Compile a full-featured Vim (w/ Python, Ruby, etc.).

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 compile_full_vim.sh 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
@sevko
sevko / README.md
Last active November 6, 2019 17:28
Import Quattroshapes into PostgreSQL.

import quattroshapes into PostgreSQL

The import_quattroshapes_pgsql.sh 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:

bash import_quattroshapes_pgsql.sh

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