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
@vfulco
vfulco / server.R
Created February 14, 2017 23:26 — forked from trestletech/server.R
A Shiny app combining the use of dplyr and SQLite. The goal is to demonstrate a full-fledged, database-backed user authorization framework in Shiny.
library(shiny)
library(dplyr)
library(lubridate)
# Load libraries and functions needed to create SQLite databases.
library(RSQLite)
library(RSQLite.extfuns)
saveSQLite <- function(data, name){
path <- dplyr:::db_location(filename=paste0(name, ".sqlite"))
@vfulco
vfulco / input.Rnw
Created February 8, 2017 23:29 — forked from yihui/input.Rnw
use knitr (knit2pdf) to generate a PDF report in a Shiny app
\documentclass{article}
\begin{document}
<<names>>=
input$firstname
input$lastname
@
\end{document}
@vfulco
vfulco / bcl-process.R
Created February 6, 2017 03:30 — forked from daattali/bcl-process.R
Process BC Liquor Store data
library(dplyr)
rawDataUrl <- "http://pub.data.gov.bc.ca/datasets/176284/BC_Liquor_Store_Product_Price_List.csv"
bcl <- read.csv(rawDataUrl, stringsAsFactors = FALSE)
products <- c("BEER", "REFRESHMENT BEVERAGE", "SPIRITS", "WINE")
bcl <- dplyr::filter(bcl, PRODUCT_CLASS_NAME %in% products) %>%
dplyr::select(-PRODUCT_TYPE_NAME, -PRODUCT_SKU_NO, -PRODUCT_BASE_UPC_NO,
-PRODUCT_LITRES_PER_CONTAINER, -PRD_CONTAINER_PER_SELL_UNIT,
-PRODUCT_SUB_CLASS_NAME) %>%
rename(Type = PRODUCT_CLASS_NAME,
Subtype = PRODUCT_MINOR_CLASS_NAME,
@vfulco
vfulco / server.R
Created February 3, 2017 15:46 — forked from daroczig/server.R
Markdown preview via shiny, pandoc and rmarkdown
library(shiny)
library(rmarkdown)
shinyServer(function(input, output) {
output$html = reactive({
t <- tempfile()
cat(input$markdown, file = t)
@vfulco
vfulco / bitbucket_ci.php
Created February 3, 2017 02:41 — forked from pawitp/bitbucket_ci.php
Poor man's CI with bitbucket
<?php
error_reporting(E_ALL | ~E_NOTICE);
// Config
$url = "https://bitbucket.org/USERNAME/PROJECT/get/master.zip";
$user = "USERNAME";
$pass = "PASSWORD";
$tempfile = "thinkbox-ci.zip";
$target = "./";
$access_key = "ACCESS_KEY";
@vfulco
vfulco / letter.latex
Created January 27, 2017 01:18 — forked from jgm/letter.latex
pandoc letter template
\documentclass[letter,$if(fontsize)$$fontsize$,$else$10pt,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{ucbletter}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{amssymb,amsmath}
\linespread{$if(linespread)$$linespread$$else$1.1$endif$}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
@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
@vfulco
vfulco / s3_presign.py
Created January 28, 2016 12:56 — forked from mdwhatcott/s3_presign.py
Generate a pre-signed S3 URL (valid for 20 years) with nothing but the standard library.
#!/usr/bin/env python
"""
Generates a pre-signed S3 URL using a valid key pair that lasts for 20 years.
Reference: http://forrst.com/posts/Python_method_for_creating_authenticated_s3_URLs-uUM
"""
import base64, hmac, os, sha, sys, time, urllib
@vfulco
vfulco / signed_url.py
Created January 25, 2016 06:47 — forked from richarvey/signed_url.py
Generate signed URL's for S3 objects from the command line (requires .boto file for credentials)
#!/usr/bin/python
import boto, argparse
parser = argparse.ArgumentParser()
parser.add_argument('-b','--bucket', help='Name of your S3 Bucket', required=True)
parser.add_argument('-o','--object', help='Name of the object + prefix in your bucket', required=True)
parser.add_argument('-t','--time', type=int, help='Expirery in seconds Default = 60', default=60)
args = vars(parser.parse_args())
@vfulco
vfulco / flask.py
Created January 20, 2016 13:03 — forked from kageurufu/flask.py
Flask-WTF FieldLists with Dynamic Entries
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.wtf import Form
from flask.ext.babel import gettext
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField
from wtforms.validators import Optional, Required
app = Flask(__name__)
db = SQLAlchemy(app)