Skip to content

Instantly share code, notes, and snippets.

@mdsumner
mdsumner / mapdeck_triangles.R
Created August 28, 2018 06:46
Exploring triangles and points in 3D with mapdeck
nc <- sf::read_sf(system.file("shape/nc.shp", package="sf"))
bb <- sf::st_bbox(nc)
bb <- bb + c(-2, -2, 2, 2)
topo <- marmap::as.raster(marmap::getNOAA.bathy(bb["xmax"], bb["xmin"], bb["ymax"], bb["ymin"],
resolution = 2))
triangles <- sf::st_cast(sfdct::ct_triangulate(nc, a = .005))
elevate_triangles <- function(g, r) {
## assuming geometry of POLYGON
@lucadealfaro
lucadealfaro / rename_by_date.py
Created November 13, 2019 17:16
Renames filenames according to the date they have been taken. A file will receive a name such as 2019-07-23_13-43-27_R0000666.jpg, where R0000666.jpg is the filename before renaming. Collisions are avoided, and files which already begin by "20" are not renamed.
#!/usr/bin/python
import argparse
import os
import shutil
import subprocess
exifcmd = "/usr/local/bin/exiftool"
def main(args):