Skip to content

Instantly share code, notes, and snippets.

View fritzvd's full-sized avatar

Fritz van Deventer fritzvd

View GitHub Profile
@fritzvd
fritzvd / build.sh
Last active December 12, 2017 09:36
libecw building for gdal
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable # unstable packages
sudo apt-get install build-essential gdal-bin gdal-config libgdal-ecw-src
wget http://meuk.technokrat.nl/libecwj2-3.3-2006-09-06.zip
unzip ~/Downloads/libecwj2-3.3.2006-09-06.zip
cd ~/Downloadslibecwj2-3.3.2006-09-06
./configure
make # wait
make install # or sudo make install
sudo gdal-ecw-build /usr/local
sudo ldconfig
@fritzvd
fritzvd / leaflet.fullscreen.js
Created March 26, 2014 14:06
leaflet quasi fullscreen on ie
// This is a customisation of a real plugin
// and lives here, purely for reference
L.Control.FullScreen = L.Control.extend({
options: {
position: 'topleft'
},
onAdd: function (map) {
console.info('this is not even fired');
var containerClass = 'leaflet-control-zoom', className, container;
@fritzvd
fritzvd / performance.js
Created September 13, 2014 10:50
Performance in javascript
// this is wrong
var multiList = [];
multiList += 'string';
multiList += 9;
multiList += 3.14;
// if you really want a list like this do this:
var multiList = ['string', 9 , 3.14];
@fritzvd
fritzvd / addGetSrid.sql
Created October 28, 2014 15:26
sql snippet for older OGR sql function in postgis (getsrid)
CREATE OR REPLACE FUNCTION ST_getsrid(geometry)
RETURNS int4
AS '$libdir/postgis-2.1','LWGEOM_get_srid'
LANGUAGE 'C' IMMUTABLE STRICT;

Keybase proof

I hereby claim:

  • I am fritzvd on github.
  • I am fritzvd (https://keybase.io/fritzvd) on keybase.
  • I have a public key whose fingerprint is 5735 97D7 779A 71A2 CFCB E96B A983 83DA EE81 9678

To claim this, I am signing this object:

@fritzvd
fritzvd / controller.html
Created April 29, 2015 07:38
controller in the html
<html>
<body ng-app="myApp">
<div ng-controller="MyFavoriteCtrl as ctrl">
{{ ctrl.superspecialvar }}
</div>
<script>
// initiate module, first argument is the name, second are dependencies
angular.module("myApp", []);
import random
entity = [
'The Flying Spaghetti Monster',
'Richard Dawkins',
'Vishnu',
'Shiva',
'Allah',
'God',
'Het Universum',
'Kanye West',
@fritzvd
fritzvd / test.js
Last active October 14, 2015 12:14
Mocking / Stubbing tns-core-modules for NativeScript testing on your host device
var assert = require('assert');
var proxyquire = require('proxyquire');
var fetchStub = require('node-fetch'); // the npm package not the tns-core-module (npm install --save-dev node-fetch)
var obsArray = Array;
var YourViewModel = proxyquire('../app/view-models/your-view-model',
{
fetch: fetchStub,
"data/observable-array": {
@fritzvd
fritzvd / index.html
Last active October 30, 2015 11:13 — forked from couchand/index.html
Draggable clip path - forked
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.min.js"></script>
</head>
<body>
<div id="chart">
</div>
<script type="text/javascript">
var w = 800,
h = 600,
@fritzvd
fritzvd / basic.py
Created April 12, 2016 14:38
Live streaming of stdout over udp with ansible // based on: http://rferrer.me/articles/live-ansible-stdout.html
import socket
# Add a custom listener to read out stdout
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
if cmd.stdout in rfd:
dat = os.read(cmd.stdout.fileno(), 9000)
stdout += dat
sock.sendto(dat, ("127.0.0.1", 9876)) # append to listener