Skip to content

Instantly share code, notes, and snippets.


Christopher Blanchard cblanc

  • ∈ { Amsterdam, London }
Block or report user

Report or block cblanc

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
View score_postcodes.ts
import * as fs from "fs";
import * as path from "path";
import * as csv from "fast-csv";
interface NumberScore {
scores: number[];
remainingString: string;
const extractNumbers = (input: string): NumberScore => {
cblanc /
Created Oct 22, 2019
Various commands to run on docker container
# Start docker container
docker run -p 5432:5432 -e POSTGRES_USER=postcodesio -e POSTGRES_DB=postcodesiodb -e POSTGRES_PASSWORD=password idealpostcodes/
# Generate postcode list
psql -h -p 5432 --username postcodesio postcodesiodb -t -A -F"," -c "SELECT postcode FROM postcodes ORDER BY postcode" > postcodes.csv
cblanc / outcodes.bash
Last active Feb 11, 2019
UK Outcodes generated from
View outcodes.bash
docker pull idealpostcodes/
docker run -p 5432:5432 idealpostcodes/
psql -h --username=postgres postgres -c "COPY (SELECT outcode FROM outcodes ORDER BY outcode) TO STDOUT WITH CSV DELIMITER ','" | pbcopy
cblanc /
Last active Feb 9, 2019 - Perl Example Postcode Lookup
# Kindly provided by github/@digdilem
my $pc = "TQ13 9XT"; # Example postcode (Dartmoor National Park Visitor's Centre, Haytor)
use LWP;
use JSON qw( decode_json );
my $ll_url = "$pc";
cblanc /
Created Jan 7, 2019
Extract NL streetnames / postcodes
# Get raw dataset
# Extract street and postcode from CSV, get unique elements and stream to file
awk -F "\"*,\"*" '{print $4,$9}' countrywide/nl/countrywide.csv | uniq > nl-postcodes.txt
View callbackify.js
const callbackifyPromiseWithTimeout = function(promise, callback) {
if (callback) {
// Ensure callback is called outside of promise stack.
return promise.then(function(res) {
setTimeout(function() { callback(null, res) }, 0);
}, function(err) {
setTimeout(function() { callback(err, null); }, 0);
cblanc / outcodes.csv
Created Mar 28, 2018
UK Outcodes - Feb 2018
View outcodes.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
cblanc / hulls.sql
Created Aug 4, 2017
Computing Hulls from a List of Geometries
View hulls.sql
-- Compute Convex Hull for a list of geolocations matching the outcode 'SW1A'
ST_AsText(ST_ConvexHull(ST_Collect(location::geometry))) AS hull
outcode = 'SW1A';
-- Compute Concave Hull for a list of geolocations matching the outcode 'SW1A'
-- Little bit more expensive but the polygons are a "tighter fit", the more you increase the second parameter the "tightness" increases but so does computational work required

Keybase proof

I hereby claim:

  • I am cblanc on github.
  • I am cablanchard ( on keybase.
  • I have a public key ASBldidyjn7X2MmOTNq50qQs-Hb-uYObpbBBZ-PuCyMlbAo

To claim this, I am signing this object:

cblanc / postalCounties.json
Created May 24, 2017
List of Postal Counties
View postalCounties.json
"West Midlands",
You can’t perform that action at this time.