Skip to content

Instantly share code, notes, and snippets.

Steve Bennett stevage

Block or report user

Report or block stevage

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stevage / gist:2210943
Created Mar 27, 2012
Checking for unsafe filename paths
View gist:2210943
Version 1:
def is_evil(filename):
import re
return"^/|\.\./|:|//", filename)
if is_evil(filename):
filename = path.basename(filename)
copyto = path.join(dataset_path, filename)
stevage / carto layers
Created Jun 22, 2013
Proposed text for TileMill/carto's documentation on layer application.
View carto layers
The order in which objects are drawn depends on the following process. Each step in the process overrules steps with higher numbers.
1. Layers. "Higher" layers obscure "lower" ones.
2. Stylesheets. Stylesheets are applied from left to right.
3. Rules within a stylesheet. Rules are applied from top to bottom. This means two things:
a. objects defined by later rules will be drawn over those defined by later rules; and
b. attachments may be redefined by later rules.
4. Attachments (eg, `::glow { ... }`) within a rule are applied from top to bottom. (The order of different symbolizers within an attachment doesn't matter.)
5. Lastly, all else being equal, objects are drawn in the order in which they are found, such as in PostGIS.
stevage /
Last active Dec 22, 2015 — forked from springmeyer/
Updated version to function more like proper bash scripts. (The 'sudo su postgres' stuff didn't work properly.)
# First, clear out any old mapnik or node.js installs that might conflict
sudo apt-get purge libmapnik libmapnik-dev mapnik-utils nodejs
# Also 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
stevage / gist:9061001
Created Feb 17, 2014
I just noticed the absurdity of this code I wrote yesterday. Javascript inside Python inside Bash inside Jinja inside YAML, and perilously close to a layer of regex too.
View gist:9061001
- cwd: /usr/share/nginx/www/osrm/WebContent
- name: |
python <<EOF
import os, sys, re
os.rename('OSRM.config.js', 'OSRM.config.js.orig')
# In the process we convert line endings for some reason. :/
with open('OSRM.config.js.orig', 'r') as fin, open('OSRM.config.js', 'w') as fout:
data =
View gist:9593835
This file has been truncated, but you can view the full file.
$ bash <<EOF
> sudo apt-get update
> sudo apt-get install -y git-core
> cd /mnt
> sudo mkdir cartodb
> sudo chown ubuntu:ubuntu cartodb
stevage / gist:9593847
Created Mar 17, 2014
Attempting to install CartoDB
View gist:9593847
sudo apt-get update
sudo apt-get install -y git-core
cd /mnt
sudo mkdir cartodb
sudo chown ubuntu:ubuntu cartodb
git clone --recursive
stevage / gist:9806720
Created Mar 27, 2014
PTVAPI-GTFS scratch 1
View gist:9806720
1. get stops
2. get lines
3. get runs
import ptvapi
import pprint
pp = pprint.PrettyPrinter(indent=4).pprint
View gist:10448452
sudo apt-get update && sudo apt-get install -y git-core curl wget screen
screen -D -R
sudo mkdir /mnt/cartodb-dev
sudo chown ubuntu:ubuntu /mnt/cartodb-dev
cd /mnt
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:3c1ae0045dc0d61f465c
var pois = new XMLHttpRequest();"GET","",true);
pois.onreadystatechange = function() {
if (pois.readyState === 4) { // Makes sure the document is ready to parse.
if (pois.status === 200) { // Makes sure it's found the file.
geojson = JSON.parse(pois.responseText);
L.geoJson(geojson, {
onEachFeature: function (feature, layer) {
You can’t perform that action at this time.