Skip to content

Instantly share code, notes, and snippets.

View TimJMartin's full-sized avatar

Tim Martin TimJMartin

  • Ordnance Survey
View GitHub Profile
@nickpeihl
nickpeihl / README.md
Last active January 18, 2024 19:47
GDAL and Elasticsearch examples

GDAL and Elasticsearch examples

Shapefile

GDAL Shapefile docs

Import shapefile into Elasticsearch

ogr2ogr -f ElasticSearch \
-lco NOT_ANALYZED_FIELDS={ALL} \
http://elastic:changeme@localhost:9200 \
@mdiener21
mdiener21 / install-postgres-postgis-gdal.sh
Last active June 24, 2020 16:18
Setup Ubuntu 16.04 for GIS development postgresql 9.6, postgis 2.3, gdal 2.1.2, python 3.5, pgrouting
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6
sudo apt-get install postgresql-9.6-postgis-2.3
sudo apt-get install postgresql-9.6-pgrouting
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@magegu
magegu / multipart.js
Last active July 11, 2023 20:12
mutipart upload for aws s3 with nodejs based on the async lib including retries for part uploads
/*
by Martin Güther @magegu
just call it:
uploadFile(absoluteFilePath, callback);
*/
var path = require('path');
var async = require('async');
@andrewxhill
andrewxhill / index.html
Last active March 22, 2017 13:07
Use Leaflet Draw to filter and style a CartoDB layer
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.draw drawing and editing tools</title>
<link
rel="stylesheet"
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
/>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<link
@matheusoliveira
matheusoliveira / json_manipulator.sql
Last active February 17, 2024 15:14
Simple PostgreSQL functions to manipulate json objects. (Note: performance is not a concern for those functions)
CREATE OR REPLACE FUNCTION public.json_append(data json, insert_data json)
RETURNS json
IMMUTABLE
LANGUAGE sql
AS $$
SELECT ('{'||string_agg(to_json(key)||':'||value, ',')||'}')::json
FROM (
SELECT * FROM json_each(data)
UNION ALL
SELECT * FROM json_each(insert_data)
@andrewxhill
andrewxhill / sql_statements.sql
Created December 8, 2013 18:53
Fun SQL statements for CartoDB
--PART 2
-- a.
SELECT * FROM tornados
SELECT cartodb_id FROM tornados
-- b.
SELECT * FROM tornados LIMIT 1
SELECT * FROM tornados LIMIT 1 OFFSET 1
SELECT * FROM tornados ORDER BY damage DESC LIMIT 10
-- c.
SELECT * FROM tornados WHERE cartodb_id < 30
@wboykinm
wboykinm / index.html
Last active January 18, 2017 12:45
Leaflet Markercluster w/ CartoDB SQL API
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<link rel="stylesheet" href="http://asset.geosprocket.com/leaflet/cluster/MarkerCluster.Default.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<link rel="stylesheet" href="http://asset.geosprocket.com/leaflet/cluster/MarkerCluster.Default.ie.css" />
<![endif]-->
<style type="text/css">
@walkermatt
walkermatt / ogr_gfs_geom_types.md
Last active October 10, 2023 08:31
List of geometry type codes that can specified in an ogr gfs file.

OGR GFS Geometry Values

The geometry type of a feature class can be specified in a .gfs file used by OGR to map from a GML document to a simple feature schema. The following numbers can be used to specify a specific geometry type:

-2147483647 Point25D
-2147483646 LineString25D
-2147483645 Polygon25D
-2147483644 MultiPoint25D
-2147483643 MultiLineString25D

-2147483642 MultiPolygon25D

@cee-dub
cee-dub / postgres_timestamp_defaults.rb
Created January 29, 2012 20:53
Convenient methods to let PostgresQL manage created/updated_at
require 'active_support/core_ext/string/filters'
module PostgresTimestampDefaults
def add_timestamp_defaults(table_name)
add_default_now(table_name, :created_at)
add_default_now(table_name, :updated_at)
add_updated_at_trigger(table_name)
end
def add_default_now(table_name, column_name)