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 / 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
@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)
@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"
}
@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)'
@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:
@kmctown
kmctown / dokku_on_do.md
Created February 22, 2016 00:20
Dokku Setup on DigitalOcean

Running Dokku on DigitalOcean

Notes on spinning up a new dokku server on DO. Inspired by this blog post by Bryan Kennedy.

Spin up

Pick a droplet

Choose the Dokku 1-click app

@jbryer
jbryer / Login.R
Last active September 24, 2020 10:35
# This script is modified by Jason Bryer (jason@bryer.org) from Huidong Tian's
# original script. The blog post describing the method is here:
# http://withr.me/authentication-of-shiny-server-application-using-a-simple-method/
# The original R script is located here: https://gist.github.com/withr/9001831
#
# This script adds two new features: 1. Render a logout button, and 2. provide
# the ability for visitors to create a new account.
#
# Within your server.R file, be sure to use:
#
@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 / text-cleaning+word2vec-gensim.py
Created November 27, 2015 02:15 — forked from a-paxton/text-cleaning+word2vec-gensim.py
Cleaning Text Data and Creating 'word2vec' Model with Gensim
# preliminaries
from pymongo import MongoClient
from nltk.corpus import stopwords
from string import ascii_lowercase
import pandas as pd
import gensim, os, re, pymongo, itertools, nltk, snowballstemmer
# set the location where we'll save our model
savefolder = '/data'