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
snippet module | |
${1:name}UI <- function(id){ | |
ns <- NS(id) | |
tagList( | |
) | |
} | |
${1:name} <- function(input, output, session){ | |
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
#devtools::install_github("cloudyr/aws.ec2") | |
# devtools::install_github("cloudyr/aws.ec2", ref = devtools::github_pull(38)) | |
# ^ Must actually install PR 38. Some broken code in the main repo | |
#devtools::install_github("cloudyr/aws.signature") | |
library(aws.signature) | |
library(aws.ec2) | |
library(furrr) | |
aws.signature::use_credentials() |
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") |
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
#!/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
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
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
#!/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(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
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get install \ | |
libxml2-dev \ | |
libsqlite-dev \ | |
libcurl4-openssl-dev \ | |
libssl-dev \ | |
libmagick++-dev |