Skip to content

Instantly share code, notes, and snippets.

View rwl's full-sized avatar
🦀

Richard Lincoln rwl

🦀
View GitHub Profile
@rwl
rwl / cimxpath.py
Created June 12, 2015 10:48
Extract geographical coords from CIM RDF/XML data
import xml.etree.ElementTree as etree
data = '''<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns:entsoe="http://entsoe.eu/Secretariat/2013/ProfileExtension/3"
xmlns:cim="http://iec.ch/TC57/2013/CIM-schema-cim16#"
xmlns:md="http://iec.ch/TC57/61970-552/ModelDescription/1#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<md:FullModel rdf:about="urn:uuid:6fdb7290-de0d-11e2-8f45-b8f6b1180b6d">
<md:Model.created>2013-06-26T00:00:00</md:Model.created>
<md:Model.DependentOn rdf:resource="urn:uuid:2399cbd2-9a39-11e0-aa80-0800200c9a66_EU"/>
@rwl
rwl / colorbrewer.go
Created April 5, 2014 19:02
Color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/)
// Copyright 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania
// State University.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
@rwl
rwl / Dockerfile
Last active August 29, 2015 13:56
Send a random number from the master node to all the slave nodes (http://techtinkering.com/2009/12/02/setting-up-a-beowulf-cluster-using-open-mpi-on-linux/)
FROM ubuntu
RUN apt-get update
RUN apt-get install -y gcc openssh-client wget openmpi-bin openmpi-common libopenmpi1.3 libopenmpi-dev
RUN wget --no-check-certificate https://gist.githubusercontent.com/rwl/b1ae2fd3908901b367b7/raw/5218b661332b4a41c752807a2258c8fdfa856a21/testprog.c
RUN mpicc testprog.c
RUN mpirun -np 10 ./a.out
@rwl
rwl / bar_chart.dart.js
Last active August 29, 2015 13:56
Bar Chart 1
// Generated by dart2js, the Dart to JavaScript compiler version: 1.1.1.
(function($){function dart() {}var A=new dart
delete A.x
var B=new dart
delete B.x
var C=new dart
delete C.x
var D=new dart
delete D.x
var E=new dart
@rwl
rwl / osm2kml.py
Created July 22, 2012 03:16
OpenStreetMap to KML conversion script
__author__ = 'Richard Lincoln, r.w.lincoln@gmail.com'
import sys
from optparse import OptionParser
from xml.etree.ElementTree import \
parse, Element, SubElement, ElementTree, register_namespace