Skip to content

Instantly share code, notes, and snippets.

@letmaik
letmaik / boundingbox.py
Last active August 29, 2015 13:56
Minimum bounding box for set of bounding boxes (longitude calculation)
import numpy as np
import numpy.ma as ma
# this is an implementation of:
# http://gis.stackexchange.com/questions/17788/how-to-compute-the-bounding-box-of-multiple-layers-in-lat-long/17987#17987
def minimumBoundingBox(lons):
xs = np.sort(lons.ravel())
xs = np.concatenate((xs,[xs[0]+360]))
@letmaik
letmaik / nssdc.py
Created February 12, 2014 18:19
Query the NSSDC Master Catalog for spacecrafts of certain disciplines
import urllib
import urllib2
import re
# To NSSDC: Please provide a REST API. Thanks.
class Discipline:
'''
as in http://nssdc.gsfc.nasa.gov/nmc/SpacecraftQuery.jsp form
'''
@letmaik
letmaik / figimage.py
Created September 12, 2014 14:42
Draw things naturally onto an image using matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
def loadFigImage(path):
im = mpimg.imread(path)
h,w = im.shape[0], im.shape[1]
dpi = 80
fig = plt.figure(figsize=(w/dpi, h/dpi), dpi=dpi)
ax = plt.Axes(fig, [0, 0, 1, 1])
ax.set_xlim(0, w)
@letmaik
letmaik / theme-37093.xml
Last active August 29, 2015 14:21
Eclipse Color Theme (Obsidian variation, esp. for Java)
<?xml version="1.0" encoding="utf-8"?>
<colorTheme id="37093" name="Obsidian Java" modified="" author="Maik">
<searchResultIndication color="#616161" />
<filteredSearchResultIndication color="#616161" />
<occurrenceIndication color="#616161" />
<writeOccurrenceIndication color="#616161" />
<findScope color="#E0E2E4" />
<deletionIndication color="#E0E2E4" />
<sourceHoverBackground color="#FFFFFF" />
<singleLineComment color="#7D8C93" />
@letmaik
letmaik / test.html
Created July 26, 2015 13:57
Performance of DataView vs inline code for little/big endian conversion (inline wins)
<!doctype html>
<html>
<body>
DataView: <span id="time_dataview"></span><br />
Inline: <span id="time_inline"></span>
<script>
var littleEndian = (function() {
@letmaik
letmaik / ndarray.html
Created August 16, 2015 19:07
Fun with ndarray and canvas
<!DOCTYPE html>
<html>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
<script src="https://jspm.io/system@0.16.js"></script>
<script>
System.import('npm:ndarray').then(function(ndarray) {
System.import('npm:ndarray-warp').then(function(warp) {
var canvas = document.getElementById('canvas')
var w = canvas.width
@letmaik
letmaik / Example.java
Created June 25, 2013 09:42
Adds CellTable's Model support to a FlexTable (Google Web Toolkit)
package com.github.neothemachine.flextable.client;
import com.github.neothemachine.flextable.client.ModelFlexTable.FlexColumn;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
@letmaik
letmaik / 0_input.jsonld
Last active May 12, 2016 10:11
GeoDCAT-AP Sandbox JSON-LD framing
{
"@graph": [{
"@id": "http://inspire-sandbox.jrc.ec.europa.eu/resource/de_e70f8705-e89d-11e2-9634-52540004b857_dataset_6555",
"@type": "http://www.w3.org/ns/dcat#Dataset",
"http://purl.org/dc/terms/modified": [{
"@value": "2015-12-03",
"@type": "http://www.w3.org/2001/XMLSchema#date"
}],
"http://www.w3.org/2000/01/rdf-schema#comment": [{
"@value": "Spatial resolution (equivalent scale): 1:1000",
@letmaik
letmaik / index.html
Last active October 28, 2016 09:00
CovJSON minimal visualization example
<!DOCTYPE html>
<html>
<style>
html, body, #map {
width: 100%; height: 100%;
margin: 0;
}
</style>
@letmaik
letmaik / print-program-options.cc
Last active January 19, 2017 15:12 — forked from gesquive/print-program-options.cc
Methods to print out boost::program_options objects (C++11)
#include <string.h>
#include <iostream>
#include "boost/program_options.hpp"
#include "boost/filesystem.hpp"
#include "boost/any.hpp"
namespace po = boost::program_options;
inline void PrintUsage(const boost::program_options::options_description desc) {
std::cout << "Usage: " << app_name << " [options]" << std::endl;