Skip to content

Instantly share code, notes, and snippets.

Drinking tea

Matt Walker walkermatt

Drinking tea
View GitHub Profile
walkermatt /
Last active Aug 25, 2021
Chalice Dev AWS IAM Policy

Chalice Dev AWS IAM Policy

AWS IAM Policy suitable for assigning to a user developing Chalice applications. Allows the developer sucessfully execute chalice deploy, chalice delete and chalice logs

Derived from comments on chalice/issues/59, extended by trial and error :-)

Subsitute YOUR-AWS-REGION in chalice-dev-iam-policy.json with the region you are deploying to, for example eu-west-1.

AWS profiles

walkermatt /
Last active Jan 13, 2021
Talk on small contributions to open source software, testing, automated builds etc.

The day the build broke 😔

The tale of a broken build and breaking changes...

And so the story begins...

  • ol-ishare is built automatically each time a change is committed to the repository
    • Formatting of source code is checked (linting)
walkermatt /
Last active Nov 11, 2020
ol-layerswitcher migration to TypeScript presentation
npx @marp-team/marp-cli --template bare -o ol-layerswitcher-typescript.html
walkermatt / confluence-table-to-csv.js
Last active Feb 21, 2018
Copy the data out of a Confluence table as CSV using Chrome devtools
View confluence-table-to-csv.js
function escapeAsCsv(str) {
// Double up double quotes and quote the entire string if necessary
if (str.includes(',') || str.includes('\n') || str.includes('"')) {
return '"' + str.replace(/"/g, '""') + '"';
return str;
// Export Confluence table as CSV
// Select the tbody element in Chrome devtools Elements panel then run the
View ol-debug.js
This file has been truncated, but you can view the full file.
// OpenLayers. See
// License:
// Version: v4.5.0-70-gfca0b07
;(function (root, factory) {
if (typeof exports === "object") {
module.exports = factory();
} else if (typeof define === "function" && define.amd) {
define([], factory);
} else {
""" Minimal MapProxy Middleware demonstrating wrapping MapProxy and working
with the query string
To run:
1. Install MapProxy in a virtual enviroment together with Gunicorn
2. Create a basic MapProxy config and copy this file into the same directory as mapproxy.yaml
2. Activate virtual environment
3. Change to the directory containing this file
4. Run:
gunicorn -k eventlet --workers=1 --log-file=- mapproxy_filter:application
walkermatt /
Created Mar 17, 2017
For use in the QGIS Python console
# Just the selected features
layer = iface.activeLayer()
for feature in layer.selectedFeatures():
print feature['name']
# Filter by current extent of the map
extent = iface.mapCanvas().extent()
request = QgsFeatureRequest()
layer = iface.activeLayer()
import itertools
import qgis
from qgis.gui import QgsMessageBar
from qgis.core import QgsMapLayer
def layer_info(layer):
print "Layer name: %s" %
print "CRS: %s" %
print "Extent: %s" % layer.extent().asWktCoordinates()

Python psycopg2 & PostGIS

Load some data into the database

From the OSGeo4W Shell

ogr2ogr -f PostgreSQL PG:"dbname=postgis host=localhost user=postgres password=postgres" -a_srs "EPSG:27700" county_region.shp -nlt MULTIPOLYGON

Use psycopg2 in the Python Interpreter

walkermatt / Rock, paper,
Created Dec 17, 2016
Rock, paper, scissors created by walkermatt -
View Rock, paper,
# Rock, paper, scissors
def beats(thing1, thing2):
""" Determine who wins rock, paper, scissors
by passing each players choice """
if thing1 == thing2:
# Draw, both players chose the same thing
return None
# Determine which thing beats thing2
victors = {