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
@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')
@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))
@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)
@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)
@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'))
@agberg
agberg / printing_flexdashboard_with_webshot
Last active November 16, 2020 21:28
Using Webshot to "Print" Flexdashboards
This gist holds the files necessary to reproduce a minimal example of "printing" a flexdashboard using a headless browser.
``` r
library(extrafont)
#> Registering fonts with R
# font_install('fontcm') # try this if its not working
suppressMessages(loadfonts())
# check that the LM Roman fonts are installed with
"CM Roman" %in% fonts()
#> [1] TRUE
# main script ============
library(shinydashboard)
library(dplyr)
library(dbplyr)
library(purrr)
library(shiny)
library(highcharter)
library(DT)
library(htmltools)
# Use the `config` package to get the credentials
@CateGitau
CateGitau / Twitter text analysis.R
Last active January 18, 2023 18:26
Analyzing twitter data using R
#install required packages
install.packages("twitteR")
install.packages("RCurl")
install.packages("httr")
install.packages("devtools")
install.packages(toInstall, repos = "http://cran.r-project.org")
library(devtools)
#Load necessary packages
library(twitteR)
@mnazarov
mnazarov / docx_flextable.Rmd
Last active March 1, 2018 23:59
Use flextable with rmarkdown for Word (docx) output
---
title: "Insert `flextable`s into Word documents generated with `rmarkdown`"
author: Maxim Nazarov
output:
word_document:
keep_md: yes
html_document:
keep_md: yes
smart: false
---