Skip to content

Instantly share code, notes, and snippets.

View snodnipper's full-sized avatar
🚀

Ollie Snowden snodnipper

🚀
  • Earth
View GitHub Profile
@snodnipper
snodnipper / gist:fc338df3dbb66e3808fa
Created August 3, 2014 20:09
Google App Engine Gradle Dependencies (all of them! you won't need them all _but_ it was annoying going through them so here they are)
compile 'com.google.appengine:appengine:1.9.7'
compile 'com.google.appengine:appengine-endpoints:1.9.7'
compile 'com.google.appengine:appengine-testing:1.9.7'
compile 'com.google.appengine:appengine-maven-plugin:1.9.7'
compile 'com.google.appengine:appengine-java-sdk:1.9.7'
compile 'com.google.appengine:appengine-local-endpoints:1.9.7'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.7'
compile 'com.google.appengine:appengine-remote-api:1.9.7'
compile 'com.google.appengine:appengine-tools-sdk:1.9.7'
compile 'com.google.appengine:appengine-jsr107cache:1.9.7'
@snodnipper
snodnipper / rename.py
Created December 4, 2014 16:58
Terrain 50 sanitiser
import os, os.path, re
for root, _, files in os.walk("./"):
for f in files:
fullpath = os.path.join(root, f)
replaced = re.sub("_OST50GRID\w*", "", f)
newfullpath = os.path.join(root, replaced)
print fullpath
print newfullpath
os.rename(fullpath, newfullpath)
@snodnipper
snodnipper / rename.py
Last active August 29, 2015 14:10 — forked from jskeates/rename.py
#! /usr/bin/python
import os, os.path, re
counterAll = 0
counterRenamed = 0
for root, _, files in os.walk("./data"):
for f in files:
counterAll += 1
@snodnipper
snodnipper / colors.xml
Created February 27, 2015 19:03
Android Material Colors
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Material Colours -->
<color name="red50">#FFEBEE</color>
<color name="red100">#FFCDD2</color>
<color name="red200">#EF9A9A</color>
<color name="red300">#E57373</color>
<color name="red400">#EF5350</color>
@snodnipper
snodnipper / gist:8531cd918e5f23101526
Created May 22, 2015 17:24
RXJava MergeWith demo
import rx.Observable;
import rx.Subscriber;
import rx.functions.Func1;
import rx.functions.Func2;
import java.util.concurrent.TimeUnit;
public class RxJavaMergeWith {
public static void main(String[] args) throws InterruptedException {
@snodnipper
snodnipper / gist:18ad37d434b3f0a8b737
Created July 9, 2015 14:01
Flight Simulator Calculation - running costs
Simulator Calculations
We assume ~12 racks (but power below is probably for 6 - 12 HPC racks depending on load)
P = IV [power = amps x volts]
rack = 30A x ~240V [note: some racks might use two 30A]
rack = 7200
E(kWh/day) = P(W) × t(h/day) / 1000(W/kW)
Energy per rack per day = 7200 x 24 / 1000
rack = 172.8 kWh/day
@snodnipper
snodnipper / main.cpp
Created December 21, 2015 18:56
Example C++ code to get high accuracy conversion between EPSG:4326 (WGS84) and EPSG:27700 (British National Grid). EPSG:4326 values may be sourced from a GPS.
#include <iostream>
#include <PROJ/proj_api.h>
int bng_1m_accuracy() {
// e.g. x = -1.8, y = 51.18; => Easting: 414075.69 Northing: 142326.96
projPJ pj_src, pj_dst;
double x, y;
int p;
@snodnipper
snodnipper / 2.vrt
Last active December 24, 2015 09:51
Using stock tools, I couldn't see an easy way to transform multiple columns simultaneously. Still, one could write out three separate files. See: https://github.com/snodnipper/bng-transformations/tree/master/examples/ogr2ogr
<OGRVRTDataSource>
<OGRVRTLayer name="process">
<SrcDataSource>process.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs +nadgrids=/Users/osnowden/code/bng-transformations/OSTN02_NTv2.gsb</LayerSRS>
<GeometryField encoding="PointFromColumns" x="MBR_XMIN" y="MBR_YMIN"/>
</OGRVRTLayer>
</OGRVRTDataSource>
@snodnipper
snodnipper / run.sh
Created April 29, 2016 19:21
Checkout Google Fonts and create Mapbox PBFs
#!/bin/bash
git clone git@github.com:google/fonts.git
git clone git@github.com:mapbox/node-fontnik.git
cd node-fontnik/
npm install
cd ..
echo "converting fonts"
find ./fonts/apache -type f -name *.ttf | sed -e 's/\(.*\/\)\([^/]*\)\(.ttf\)$/mkdir -p mbfonts\/\2;.\/node-fontnik\/bin\/build-glyphs \1\2\3 mbfonts\/\2 /g' | bash
@snodnipper
snodnipper / together.json
Last active July 22, 2016 13:22
hack day "demo" smart building sensor data
{
"meeting_rooms": {
"total_rooms": 50,
"available": 5
},
"restaurant": {
"special": "Fish and Chips!",
"special_image": "http://uploads.webflow.com/558957bd52a311f7085f767d/55983c6c6b6ebb72637456f8_codandchips.png"
},
"is_service_desk": {