Skip to content

Instantly share code, notes, and snippets.

View vfulco's full-sized avatar

Vincent C Fulco vfulco

  • Weisisheng Corporate Management Consulting (Shanghai) Ltd.
  • Shanghai, China
View GitHub Profile
@vpnagraj
vpnagraj / moma.Rmd
Created February 29, 2016 21:41
rmarkdown with embedded shiny app
---
title: "MOMA"
author: "VP Nagraj"
date: "February 29, 2016"
output: html_document
runtime: shiny
---
The Museum of Modern Art (MOMA) collection database is publicly available via Github:
@sandys
sandys / mailr_send.R
Last active October 10, 2018 21:08
R code to send email using Amazon SES
# first install mailR. It is a bit funky to install this because of the dependency on rJava
#First install java
### sudo add-apt-repository ppa:webupd8team/java
### sudo apt-get update
### sudo apt-get install oracle-java8-installer
#now you can install mailR. The assumption is that java is in /usr/lib/jvm/jdk1.8.0_66/. Check if a newer version has changed the directory
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ R CMD javareconf
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ Rscript -e 'install.packages(c("mailR"), .Library.site[1], repos="http://cran.us.r-project.org", dependencies=TRUE)'
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@m-Py
m-Py / wordCountRmdFile.R
Last active February 2, 2018 11:46
Count words in Rmd file using the package wordcountaddin
# This function reads a Rmd file and returns the word count
# It uses the wordcountaddin and koRpus packages
text_stats_file <- function(rmdFile) {
rmd <- file(rmdFile, "rt")
text <- readLines(rmd)
conText <- ""
for (i in text) {
conText <- paste(conText, i)
}
close(rmd)
@vfulco
vfulco / Dockerfile
Created May 13, 2016 02:38 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@mjul
mjul / Dockerfile
Created June 2, 2016 08:53
Running R scripts in a Docker container
FROM r-base:latest
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
@hrbrmstr
hrbrmstr / do_rpt.r
Last active March 16, 2023 21:51
parallel, parameterized knitr reports
library(doParallel)
rpts <- list(list(out="one.html", params=list(some_var="One")),
list(out="two.html", params=list(some_var="Two")),
list(out="three.html", params=list(some_var="Three")),
list(out="four.html", params=list(some_var="Four")))
do_rpt <- function(r) {
require(rmarkdown)
@MarkEdmondson1234
MarkEdmondson1234 / send_email_mailgun.R
Last active October 19, 2024 04:11
Send an email via an R function using Mailgun
#' Email a user a report is ready
#'
#' Requires an account at Mailgun: https://mailgun.com
#' Pre-verification can only send to a whitelist of emails you configure
#'
#' @param email Email to send to
#' @param mail_message Any extra info
#'
#' @return TRUE if successful email sent
#' @import httr
@jaehyeon-kim
jaehyeon-kim / ideas.txt
Created September 12, 2016 03:36
ideas
**** Web Server (UI)
ShinyProxy
https://github.com/openanalytics/shinyproxy
https://github.com/openanalytics/shinyproxy-demo
http://www.shinyproxy.io/
Modularizing Shiny app code - http://shiny.rstudio.com/articles/modules.html
http://stackoverflow.com/questions/25306519/shiny-saving-url-state-subpages-and-tabs
@vpnagraj
vpnagraj / app.R
Created November 17, 2016 17:43
skeleton of a shiny app to setwd and source R scripts
library(shiny)
options(shiny.reactlog=TRUE)
# define home dir for shiny app
homed <- getwd()
# set up choices to be retrievable in server.R
progchoices <- c("This is a TEST APP" = "testapp/",
"Yet Another Program" = "anotherprog/")
ui <- fluidPage(