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
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9123/predict?val=190')) | |
microbenchmark:::microbenchmark(system('curl http://127.0.0.1:9124/predict?val=190')) |
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(shinyBS) | |
library(shinydashboard) | |
library(leaflet) | |
library(ggplot2) | |
library(dplyr) | |
library(plotly) | |
library(RColorBrewer) | |
library(geojsonio) | |
library(data.table) |
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
## Authentication | |
## This is a small app to demonstrate user-managed authentication without encoded passwords. | |
## Users are stored in a SQL database with passwords along with roles. | |
## Once a user is logged in the shiny app responds to the user's role. | |
## In order to use in a real setting, additional code for password management, | |
## changing and resetting would need to be implemented. | |
library(shiny) | |
library(RSQLite) |
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
#setup | |
library(magick) | |
windowsFont("Roboto") | |
# inputs | |
setwd("c:/Users/steph/Dropbox/Locke Data/LoginCards/") | |
myfile <- "MiniBack.pdf" | |
n<-100 | |
# write.csv(data.frame(usernames=paste0("u",stringr::str_pad(1:n,pad = "0",width = 3)) | |
# ,pwords=random::randomStrings(n,len = 6,digits = FALSE,loweralpha = FALSE)) |
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 Rscript | |
args <- commandArgs(trailingOnly = TRUE) | |
if (is.na(args[1])) { | |
cat('Missing file name\n') | |
q('no') | |
} else { | |
file <- args[1] | |
} | |
if (is.na(args[2])) { | |
cat('No port specified - defaulting to 8080\n') |
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) | |
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( |
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
**** 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 |
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
#' 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 |
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(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) |
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
FROM r-base:latest | |
COPY . /usr/local/src/myscripts | |
WORKDIR /usr/local/src/myscripts | |
CMD ["Rscript", "myscript.R"] |