Skip to content

Instantly share code, notes, and snippets.

View ateucher's full-sized avatar

Andy Teucher ateucher

View GitHub Profile
## GOAL:
## re-create a figure similar to Fig. 2 in Wilson et al. (2018),
## Nature 554: 183-188. Available from:
## https://www.nature.com/articles/nature25479#s1
##
## combines a boxplot (or violin) with the raw data, by splitting each
## category location in two (box on left, raw data on right)
# initial set-up ----------------------------------------------------------
sudo apt-get update
sudo apt-get upgrade
# gdal
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
# postgres/postgis
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb
#pg_config --pkglibdir is useful for finding your $libdir
cp -a /usr/local/share/postgresql/extension/postgis* /usr/local/Cellar/[email protected]/9.6.5/share/[email protected]/extension/
cp -a /usr/local/lib/postgresql/postgis-2.3.so /usr/local/Cellar/[email protected]/9.6.5/lib/postgis-2.3
cp -a /usr/local/lib/postgresql/rtpostgis-2.3.so /usr/local/Cellar/[email protected]/9.6.5/lib/
@tjmahr
tjmahr / ggpreview.R
Created October 2, 2017 12:32
ggpreview - preview ggsave output in system image viewer
library(ggplot2)
# preview a file that would be created by ggsave()
ggpreview <- function(...) {
fname <- tempfile(fileext = ".png")
ggsave(filename = fname, ...)
system2("open", fname)
invisible(NULL)
}
# ------------------------------------------
# PostgreSQL configuration file customizations
# ------------------------------------------
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
# 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

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.

@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

#!/bin/bash
TODAY=`date +%Y-%m-%d`
TODAY_MD=`date +%B\ %d,\ %Y`
YEAR=`date +%Y`
PROJECT=$1
##
## CHANGE ME!!!
@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"