Skip to content

Instantly share code, notes, and snippets.

View snodnipper's full-sized avatar
🚀

Ollie Snowden snodnipper

🚀
  • Earth
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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'