Skip to content

Instantly share code, notes, and snippets.

View arthur-e's full-sized avatar

K. Arthur Endsley arthur-e

View GitHub Profile
@arthur-e
arthur-e / graham_hull.py
Last active April 7, 2024 17:19 — forked from tixxit/hull.py
Graham's scan convex hull algorithm, updated for Python 3.x
def convex_hull_graham(points):
'''
Returns points on convex hull in CCW order according to Graham's scan algorithm.
By Tom Switzer <thomas.switzer@gmail.com>.
'''
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0)
def cmp(a, b):
return (a > b) - (a < b)
@arthur-e
arthur-e / Stats.js
Last active December 26, 2015 22:08 — forked from clauswitt/Stats.js
A JavaScript function ("class") that returns an object which can be used to calculate statistics on the the passed numeric Array.
/**
Returns an object which can be used to calculate statistics on the
the passed numeric Array.
*/
var Stats = function (arr) {
arr = arr || [];
// http://en.wikipedia.org/wiki/Mean#Arithmetic_mean_.28AM.29
this.arithmeticMean = function () {
var i, sum = 0;
@arthur-e
arthur-e / install-tilemill-latest.sh
Created October 5, 2012 13:27 — forked from springmeyer/install-tilemill-latest.sh
Install bleeding edge TileMill, Node.js, and Mapnik
# Clear out any old ppa's that might conflict
sudo rm /etc/apt/sources.list.d/*mapnik*
sudo rm /etc/apt/sources.list.d/*developmentseed*
sudo rm /etc/apt/sources.list.d/*chris-lea*
# Add new ppa's
echo 'yes' | sudo apt-add-repository ppa:chris-lea/node.js
echo 'yes' | sudo apt-add-repository ppa:mapnik/nightly-trunk
# Update