This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This lets you type `make` | |
# and will pandoc all *.Rmd files in the letters directory | |
# into pdfs stored in the output directory | |
all: readme letters | |
#generate all letters | |
SRC=$(wildcard letters/*.Rmd) | |
OUT=$(patsubst letters/%.Rmd, output/%.pdf, $(SRC)) | |
letters: $(OUT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat | |
# Originally seen at http://spatial.ly/2014/08/population-lines/ | |
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess, | |
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after | |
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line. | |
# The result of the code below can be seen at http://imgur.com/ob8c8ph | |
library(tidyverse) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get install \ | |
libxml2-dev \ | |
libsqlite-dev \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libmagick++-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(httr) | |
# OAuth setup -------------------------------------------------------- | |
# Most OAuth applications require that you redirect to a fixed and known | |
# set of URLs. Many only allow you to redirect to a single URL: if this | |
# is the case for, you'll need to create an app for testing with a localhost | |
# url, and an app for your deployed app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script stashes the currently staged changes, and leaves everything else in the working directory as-is. | |
# (source: https://stackoverflow.com/questions/14759748/stashing-only-staged-changes-in-git-is-it-possible/39644782#39644782) | |
# Prompt for the desired repo path | |
REPOPATH= | |
read -p "Enter the repo path, or press ENTER for current dir: " REPOPATH | |
# Read the desired stash description from the command line, or prompt the user for it if necessary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(ore) | |
library(tidyverse) | |
library(jericho) | |
options("HTTPUserAgent"="hrbrbot") | |
pg <- read_html("https://help.github.com/") | |
html_nodes(pg, "a") %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(DBI) | |
library(dplyr) | |
library(pool) | |
pool <- dbPool(drv = RPostgres::Postgres(), | |
dbname = "rstudioconftweets", | |
host = "rstudioconf-tweets.c0azx4micevq.us-east-1.rds.amazonaws.com", | |
user = "guest", | |
password = "guest", | |
port = 5432) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TODAY=`date +%Y-%m-%d` | |
TODAY_MD=`date +%B\ %d,\ %Y` | |
YEAR=`date +%Y` | |
PACKAGENAME=$1 | |
## | |
## CHANGE ME!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ncdf4) | |
require(ncdf4.helpers) | |
require(data.table) | |
## Get the name of the value vars in the nc file | |
get_nc_value_name <- function(nc_file) { | |
## Get names | |
nc_obj <- nc_open(nc_file) | |
name<-names(nc_obj$var) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example demonstrates running furrr code distributed on 2 AWS instances ("nodes"). | |
# The instances have already been created. | |
library(future) | |
library(furrr) | |
# Two t2.micro AWS instances | |
# Created from http://www.louisaslett.com/RStudio_AMI/ | |
public_ip <- c("34.205.155.182", "34.201.26.217") |