Skip to content

Instantly share code, notes, and snippets.

View ateucher's full-sized avatar

Andy Teucher ateucher

View GitHub Profile
@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()))
library(tigris)
library(rgeos)
library(stringr)
library(leaflet)
# Pull the ZCTAs
zips <- zctas(cb = TRUE, starts_with = c('75', '76'))
plot(zips)
@pdanford
pdanford / README.md
Last active July 19, 2025 05:02
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


@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.
@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 / rs_lig.sh
Last active May 11, 2017 21:38
Enable ligatures in RStudio
#!/bin/sh
## Enables ligatures in RStudio. This is for Windows. You will need to open this in a shell with admin priveleges (with sed available).
## On other OSes you will need to change the path to 'www/index.htm' and possibly run with sudo.
## source: https://github.com/tonsky/FiraCode/wiki/RStudio-instructions
sed -e "s/<body>/<body><style>*{text-rendering: optimizeLegibility;}<\/style>/" "c:\Program Files\Rstudio\www\index.htm" > \
"c:\Program Files\Rstudio\www\index.htm.tmp" && \
mv "c:\Program Files\Rstudio\www\index.htm.tmp" "c:\Program Files\Rstudio\www\index.htm"
#!/bin/bash
TODAY=`date +%Y-%m-%d`
TODAY_MD=`date +%B\ %d,\ %Y`
YEAR=`date +%Y`
PROJECT=$1
##
## CHANGE ME!!!
@ateucher
ateucher / RStudio_View_HOME.md
Last active January 4, 2018 22:13
Slow RStudio View() on PC with HOME drive on a network

Using View() is very slow - RStudio v1.1.336 on Windows 7 in an enterprise environment

In RStudio View(iris) is very slow - it locks up RStudio for ~5-10s or more. I have no idea why this difference exists.

I ran the following to find out my HOME directory:

$ echo $HOME

This returns /h/ - my Home drive on the network

It's a very astute and appropriate question & one I touched on in a blog (link at end of twitter rant :-)

There are a few reasons for githubbing. The ones here are far from exhaustive.

First, many folks are fleshing out an idea (so it's a short-or-long WIP) and also looking for collaborators and testers. This is a good/necessary iteration step IMO as it garners attention from the community and one can get a sense for the utility/desirability/reach.

The "CRAN" hurdle is a serious effort that all pkg authors (even if they aren't on GH or CRAN) should strive to vault since the checks associated with it really help with overall package quality.

Now, I'm as "guilty" as anyone else when it comes to having GH-only packages and I do it for many reasons.

# install gdal, python, postgresql/postgis on Ubuntu 16.04
# install dependencies
sudo apt install unzip
sudo apt-get update
sudo apt-get install python-pip
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
pip install --upgrade pip