Skip to content

Instantly share code, notes, and snippets.

View danwild's full-sized avatar

Dan Wild danwild

View GitHub Profile
@danwild
danwild / L.CanvasOverlay.js
Created June 27, 2016 01:02 — forked from Sumbera/L.CanvasOverlay.js
Leaflet Canvas Overlay
/*
Generic Canvas Overlay for leaflet,
Stanislav Sumbera, April , 2014
- added userDrawFunc that is called when Canvas need to be redrawn
- added few useful params fro userDrawFunc callback
- fixed resize map bug
inspired & portions taken from : https://github.com/Leaflet/Leaflet.heat
License: MIT
@danwild
danwild / install_netcdf4.sh
Created November 4, 2016 00:53
Install netCDF4 in Ubuntu
#!/bin/bash
# Script to install hdf5 and netCDF4 libraries on a Linux Ubuntu system
# After: https://code.google.com/p/netcdf4-python/wiki/UbuntuInstall
# And http://unidata.github.io/netcdf4-python/
# You can check for newer version of the programs on
# ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/
# and other sources
@danwild
danwild / meteor-nginx
Created November 17, 2016 03:17 — forked from dweldon/meteor-nginx
This is an example of how to configure nginx to serve a meteor app.
server {
listen 80;
server_name app.example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443;
server_name app.example.com;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danwild
danwild / jetbrains-idea.desktop
Last active July 5, 2017 00:02
Ubuntu desktop icon to run Intellij IDEA with JAVA_HOME explicitly defined
# /usr/share/applications/jetbrains-idea.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/opt/idea-IU-143.2370.31/bin/idea.png
Exec=env JAVA_HOME=/usr/java/jdk1.8.0_131 "/opt/idea-IU-143.2370.31/bin/id$
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
let myJSON = JSON.stringify(objectToClone, function(key, value){
if(key == "troublesomeProperty"){
return undefined;
}
return value;
});
@danwild
danwild / set_extent.py
Created November 20, 2017 05:12
Set GeoTIFF extent/bounds with python GDAL
import gdal
in_file = '/Users/foo/Desktop/reproject/before.tif'
out_file = '/Users/foo/Desktop/reproject/after.tif'
# minX, minY, maxX, maxY
new_bounds = [
-78.0078239440917969,
-40.0333147430419922,
-66.0144157409667969,
@danwild
danwild / subset_examples.py
Last active September 8, 2020 12:56
Crop a NetCDF file by XY, Z, and Time with CDO + python bindings
# setup
from cdo import *
cdo = Cdo()
cdo.debug = True
in_file = '/path/to/in_file.nc'
out_file = '/path/to/out_file.nc'
date1 = '2018-03-01T00:00:00'
date2 = '2018-03-01T02:00:00'
# my target is in meters
@danwild
danwild / cmd.md
Created July 30, 2018 22:59
Use tree command to produce project structure diagram

-L 3 == 3 levels deep -I node_modules ignore

tree -v -L 3 --charset utf-8 -I node_modules

@danwild
danwild / d3-path-animation.html
Last active April 19, 2024 08:28
D3 animate dashed paths to represent flow
<!--https://stackoverflow.com/a/39731911/1177832-->
<!DOCTYPE html>
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3.js"></script>
<style>
.node {
fill: #dddddd;
stroke: gray;