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
@badbye
badbye / benchmark.R
Created June 2, 2017 16:28
Benchmark of R's http framework
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'))
@fouadyared
fouadyared / global.R
Created May 1, 2017 01:07
Files for "University Return on Investment" Shiny App (by Fouad Yared)
library(shiny)
library(shinyBS)
library(shinydashboard)
library(leaflet)
library(ggplot2)
library(dplyr)
library(plotly)
library(RColorBrewer)
library(geojsonio)
library(data.table)
@harveyl888
harveyl888 / manage_users_no_encryption.R
Created March 30, 2017 12:36
Manage users without encryption (R Shiny App)
## 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)
@stephlocke
stephlocke / generate.R
Last active October 19, 2019 22:40
Generate card backs for user logins
#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))
@sellorm
sellorm / plumberStart.R
Last active September 22, 2017 16:10
A quick script, written in R, to launch API's written using the plumber package for R. Don't forget to 'chmod +x plumberStart.R'. Usage should be 'plumberStart.R /path/to/plumber/file.R <port>', if port is omitted, the script will use 8080 as a default
#!/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')
@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(
@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
@MarkEdmondson1234
MarkEdmondson1234 / send_email_mailgun.R
Last active March 18, 2024 14:06
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
@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)
@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"]