Skip to content

Instantly share code, notes, and snippets.

View moldach's full-sized avatar

Matthew J. Oldach moldach

View GitHub Profile
@moldach
moldach / gist:552cc704ced328a0120394271404779f
Created October 2, 2019 17:42
Shapefiles and Raster of Relief do not match for Hawaii
### This method works for Switzerland and The USA (shown here, at the top) but not Hawaii (shown at the bottom)
library(sf)
library(raster)
library(dplyr)
library(ggplot2)
## USA
# download shapefile: https://catalog.data.gov/dataset/tiger-line-shapefile-2017-nation-u-s-current-state-and-equivalent-national
usa_geo <- read_sf("data/shapefiles/usa/tl_2017_us_state.shp")
@moldach
moldach / ez-extract
Created September 21, 2017 19:38
Function to easily uncompress a variety of formats in Linux - add this to .bashrc. then run it on file (e.g. extract file.zip)
# Extracting various compression files made easy
extract() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;