Skip to content

Instantly share code, notes, and snippets.

View ateucher's full-sized avatar

Andy Teucher ateucher

View GitHub Profile
@pachadotdev
pachadotdev / r_python_homebrew.sh
Last active October 9, 2022 06:41
Install R and Python via Homebrew
# See http://pacha.hk/2017-07-12_r_and_python_via_homebrew.html
# XCode CLT
xcode-select --install
# Update Homebrew and add formulae
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@ateucher
ateucher / GDAL_with_python
Last active November 28, 2016 23:26
Various gis setup tips on Windows
Install Python (Anaconda is easiest)
As explained here: https://pythongisandstuff.wordpress.com/2016/04/13/installing-gdal-ogr-for-python-on-windows/,
download the compiled GDAL from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
Then:
$ pip install GDAL-blah-blah.whl
If fiona (https://github.com/Toblerity/Fiona) is required, download it from http://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona and install it the same way.
@pdanford
pdanford / README.md
Last active May 5, 2025 11:36
Launching iTerm2 from macOS Finder

Launching iTerm2 from macOS Finder

(Based on info from Peter Downs' gitub but with modified behavior to open a new terminal window for each invocation instead of reusing an already open window.)

The following three ways to launch an iTerm2 window from Finder have been tested on iTerm2 version 3+ running on macOS Mojave+.

pdanford - April 2020


library(tigris)
library(rgeos)
library(stringr)
library(leaflet)
# Pull the ZCTAs
zips <- zctas(cb = TRUE, starts_with = c('75', '76'))
plot(zips)
@gavinsimpson
gavinsimpson / simulate.gamm.R
Last active October 26, 2018 08:46
S3 method for simulate() for "gamm" objects from package mgcv
`simulate.gamm` <- function(object, nsim = 1, seed = NULL, newdata,
freq = FALSE, unconditional = FALSE, ...) {
if (!exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE))
runif(1)
if (is.null(seed))
RNGstate <- get(".Random.seed", envir = .GlobalEnv)
else {
R.seed <- get(".Random.seed", envir = .GlobalEnv)
set.seed(seed)
RNGstate <- structure(seed, kind = as.list(RNGkind()))
@pramsey
pramsey / ccog-readinglist.md
Last active September 3, 2021 00:30
Canadian Council on Geomatics Reading List
@emhart
emhart / prism_leaflet.R
Created October 29, 2015 05:36
Create javascript leaflet maps of prism data
library(devtools)
install_github("ropensci/prism")
library(leaflet)
library(raster)
library(prism)
## Set default path for raster files
options(prism.path = "~/prismtmp")
get_prism_normals(type="tmean",resolution = "4km",annual =T, keepZip=F)
@ateucher
ateucher / find_parens.R
Created October 16, 2015 21:50
Find matching parens in a string
find_matching_paren <- function(str, open_paren = "(") {
close_paren <- switch(open_paren, "(" = ")", "{" = "}", "[" = "]")
# Split string into single characters
str <- strsplit(str, "")[[1]]
## Find the first openening parenthesis in the string
start_pos <- grep(paste0("\\", open_paren), str)[1] + 1
counter <- 1
@hadley
hadley / beer.R
Last active September 10, 2015 16:49
bottles_of_beer <- function(i = 99) {
message("There are ", i, " bottles of beer on the wall, ", i, " bottles of beer.")
while(i > 0) {
tryCatch(
Sys.sleep(1),
interrupt = function(err) {
i <<- i - 1
if (i > 0) {
message(
"Take one down, pass it around, ", i,
#' @export
coord_proj <- function(proj="+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",
inverse = FALSE, degrees = TRUE,
ellps.default="sphere", xlim = NULL, ylim = NULL) {
try_require("proj4")
coord(
proj = proj,
inverse = inverse,
ellps.default = ellps.default,
degrees = degrees,