Skip to content

Instantly share code, notes, and snippets.

View TimJMartin's full-sized avatar

Tim Martin TimJMartin

  • Ordnance Survey
View GitHub Profile
@TimJMartin
TimJMartin / AddressBase Premium Create Tables SQL
Last active August 29, 2015 14:05
AddressBase Premium Create Tables SQL
#-------------------------------------------------------------------------------
# Name: `AddressBase Premium Create Table SQL
# Purpose: `This SQL code is to be used along side the Getting Started Guide
# to setup the AddressBase Premium tables within a database
# Created: `12/08/2014
# Copyright: `Crown Copyright (c) Ordnance Survey 2014
# Licence: `THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@TimJMartin
TimJMartin / AddressBase Premium CSV Splitter Python Script
Last active June 7, 2016 11:45
AddressBase Premium CSV Splitter Python Script
#!/usr/bin/env python
"""
PREREQUISITE
Python 2.7 - this script has only been tested against Python 2.7
SYNOPSIS
To run script: python AddressBasePremium_RecordSplitter.py
@TimJMartin
TimJMartin / AddressBase Premium Lookup table SQL
Last active August 29, 2015 14:05
AddressBase Premium Lookup table SQL
#-------------------------------------------------------------------------------
# Name: `AddressBase Premium Lookup Table SQL
# Purpose: `This SQL code can be used to create a new lookup table which contains
# the core attributes of AddressBase Premium. This code will work if
# the user has the same table names/structure as described in the Getting
# Started Guide found on the AddressBase Premium product page.
# Created: `12/08/2014
# Copyright: `Crown Copyright (c) Ordnance Survey 2014
# Licence: `THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@TimJMartin
TimJMartin / AddressBase Premium GAWK Split
Last active August 29, 2015 14:05
AddressBase Premium GAWK Split CSV Files code
#-------------------------------------------------------------------------------
# Name: `AddressBase Premium GAWK Script
# Purpose: `This code is to be used along side the Getting Started Guide
# which explains the process to use GAWK to split the CSV files
# by record identifier.
# Created: `12/08/2014
# Copyright: `Crown Copyright (c) Ordnance Survey 2014
# Licence: `THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@TimJMartin
TimJMartin / gist:3e47bfa02add8556fbc4
Last active August 29, 2015 14:06
EC2 Ubuntu Server Setup
Installing NodeJS
http://blog.izs.me/post/87525128203/how-to-install-node-js-and-npm-on-ubuntu-14-04
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Install Unzip
sudo apt-get install unzip
Install node 4.2.1
Use HTML and main.js from electron getting started guide
Configure package.json to include:
"dependencies": {
"gdal": "naturalatlas/node-gdal#win-node-4.2.1"
}
Then install electron rebuild which recompiles native node modules.
npm install --save-dev electron-rebuild
@TimJMartin
TimJMartin / POI Classifications
Created March 8, 2016 08:33
POI Classifications SQL
--SQL to create POI Classifications Table
DROP TABLE IF EXISTS poi.classifications;
COMMIT;
CREATE TABLE IF NOT EXISTS poi.classifications(
CLASSIFCATION_CODE VARCHAR(8) NOT NULL PRIMARY KEY
,GROUP_ID VARCHAR(2) NOT NULL
,GROUP_DESCRIPTION VARCHAR(34) NOT NULL
,CATEGORY_ID VARCHAR(2) NOT NULL
@TimJMartin
TimJMartin / index.js
Created April 28, 2016 08:53
NodeJS Script for finding just zip files from a path
//Code snipped to use recursive-readdir to provide a list of required file types.
var path = require('path');
var recursive = require('recursive-readdir');
function ignoreFunc(file, stats) {
// `file` is the absolute path to the file and we can use extname to look at the file extension
return stats.isFile() && path.extname(file) != ".zip";
}
// Ignore files using the ignroeFunc
@TimJMartin
TimJMartin / A Useful PostGIS queries and functions
Last active August 9, 2016 06:59
Some very useful PostgreSQL/PostGIS queries and functions
The following is a set of useful PostGIS queries and functions
swagger: '2.0'
info:
version: 1.0.0
title: Building Geospatial APIs
description: Getting started with OpenAPI Specification
schemes:
- http
- https
paths:
/message: