Skip to content

Instantly share code, notes, and snippets.

View dlebauer's full-sized avatar
😀

David LeBauer dlebauer

😀
View GitHub Profile
@dlebauer
dlebauer / daylight.R
Last active December 9, 2019 19:15 — forked from hrbrmstr/daylight.R
daylight for tucson ... still needs work
library(maptools)
library(ggplot2)
library(gridExtra)
library(scales)
library(lubridate)
# adapted from http://r.789695.n4.nabble.com/maptools-sunrise-sunset-function-td874148.html
ephemeris <- function(lat, lon, date, span=1, tz="UTC") {
lon.lat <- matrix(c(lon, lat), nrow=1)
@dlebauer
dlebauer / docker-compose.override.yml
Last active December 14, 2018 22:26 — forked from robkooper/docker-compose.override.yml
PEcAn docker override . docker-compose -p pecan -f docker-compose.override.yml up
version: "3"
services:
# mount PEcAn web folder into web server, this allows for
# editing code in PHP and immediatly test the new code.
web:
volumes:
- ${HOME}/git/pecan/web:/var/www/html/pecan
- ${HOME}/git/pecan/docker/config.docker.php:/var/www/html/pecan/config.php
@dlebauer
dlebauer / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
### this works
SELECT cartodb_id, ST_GeomFromText(replace(replace(replace(replace(replace(geometry, '<Polygon><outerBoundaryIs><LinearRing><coordinates>', 'Linestring('), '</coordinates></LinearRing></outerBoundaryIs></Polygon>', ')'), ',', '$'), ' ', ','), '$', ' '),4326) geom FROM test_yield_county
### the official query
delete FROM test_yield_county where geometry = ''
with f as (SELECT cartodb_id, ST_GeomFromText(replace(replace(replace(replace(replace(geometry, '<Polygon><outerBoundaryIs><LinearRing><coordinates>', 'Linestring('), '</coordinates></LinearRing></outerBoundaryIs></Polygon>', ')'), ',', '$'), ' ', ','), '$', ' '),4326) geom FROM test_yield_county order by geometry desc)
update test_yield_county d
set the_geom = (