Skip to content

Instantly share code, notes, and snippets.

@isedwards
isedwards / gist:6049594
Last active December 20, 2015 01:29
OSM Bright - imposm - Postgres/PostGIS - Mapnik - TileMill - MBTiles script (ubuntu)
mkdir tile_cache
cd tile_cache
# Download Open Street Map Data
mkdir osm_data
cd osm_data
wget http://download.geofabrik.de/europe/great-britain/england/devon-latest.osm.pbf
wget http://download.geofabrik.de/europe/great-britain/england-latest.osm.pbf
cd ..
@isedwards
isedwards / img_tiles.py
Created August 8, 2013 13:54
Add to lib/cartopy/io/img_tiles.py to enable loading image tiles from an MBTiles file. Unfortunately the demo (see comments below) does not currently work due to new bug: https://github.com/SciTools/cartopy/issues/312
class MBTiles(GoogleTiles):
''' Retrieve tile data from MBTiles sqlite database instead of a url '''
def __init__(self, tile_db):
self.tile_db = tile_db
GoogleTiles.__init__(self)
def get_image(self, tile):
import cStringIO
import sqlite3
sudo apt-get -y install python2.7-dev
sudo apt-get -y install qt-sdk
sudo apt-get -y --force-yes install cmake
sudo apt-get -y git
# the following two lines may not be necessary
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py
mkdir -p ~/git
@isedwards
isedwards / usethisone
Created September 16, 2013 08:55
USE THIS ONE
#sudo apt-get -y install python2.7-dev
sudo apt-get -y install qt-sdk
sudo apt-get -y --force-yes install cmake
sudo apt-get -y install git
# the following two lines may not be necessary
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
sudo python ez_setup.py
mkdir -p ~/git
@isedwards
isedwards / wms.ipynb
Created April 17, 2014 15:29
Example WMS interface for Cartopy GeoAxes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isedwards
isedwards / wms.ipynb
Created April 17, 2014 15:30
Example WMS interface for Cartopy GeoAxes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
@isedwards
isedwards / beautiful_idiomatic_python.md
Created May 28, 2017 20:28 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@isedwards
isedwards / how-to-set-up-stress-free-ssl-on-os-x.md
Created November 9, 2017 11:49 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@isedwards
isedwards / windrose.R
Created September 23, 2020 09:51
windrose
#- windrose.- Wind rose from a data frame with columns: DateTime, Dir, Speed.
# Version 1.0 (2020-08-08), by Jose A. Guijarro. (GPL license >= 2.0).
#---------------------------------------------------------------------------
# data: Data frame with columns 'DateTime, Dir, Speed'
# code: Station code
# name: Station name
# uni='m/s': Wind speed units (for the legend).
# maxnsc=8 : Maximum number of wind speed classes.
# fnum=4 : Number of reference circles to plot.
# fint=5 : Frequency intervals (in %) of the reference circles.