Skip to content

Instantly share code, notes, and snippets.

Avatar

Alvin Thomas alvinthomas

View GitHub Profile
@alvinthomas
alvinthomas / docker_example.sh
Created Oct 28, 2019
An example using a modified docker tidyverse to output a list
View docker_example.sh
#!/usr/bin/env bash
docker pull rocker/tidyverse
mkdir temp
cd temp
git clone https://gist.github.com/6972090d67ae353d39a11611f00d8dd0.git
mv ./6972090d67ae353d39a11611f00d8dd0 ./docker_example
cd docker_example
docker build -t docker_example .
@alvinthomas
alvinthomas / run_docker_example.sh
Created Oct 28, 2019
Small bash script to run docker_example (see docker_example.sh)
View run_docker_example.sh
#!/usr/bin/env bash
docker run --rm -d -v $(pwd):$(pwd) -w $(pwd) docker_example Rscript hgwells_wordcounts2.R
@alvinthomas
alvinthomas / hgwells_wordcounts2.R
Created Oct 28, 2019
Gutenbergr and tidytext example with write_csv()
View hgwells_wordcounts2.R
library(tidyverse)
library(tidytext)
library(gutenbergr)
# Example from https://www.tidytextmining.com/tidytext.html
hgwells = gutenberg_download(c(35, 36, 5230, 159))
tidy_hgwells <- hgwells %>%
unnest_tokens(word, text) %>%
@alvinthomas
alvinthomas / dockerfile
Created Oct 28, 2019
dockerfile_example_20191028
View dockerfile
FROM rocker/tidyverse
RUN Rscript -e "install.packages(c('tidytext', 'gutenbergr'))"
@alvinthomas
alvinthomas / _config.yml
Created Jun 29, 2017
Re-direct to statsnips
View _config.yml
theme: jekyll-theme-minimal
gems:
- jekyll-redirect-to
@alvinthomas
alvinthomas / base16-shapeshifter-mod-lighten.minttyrc
Created Mar 10, 2017
Copy of Base-16 Shapeshifter Theme for Mintty from https://github.com/oumu/mintty-color-schemes and Personal Mintty RC
View base16-shapeshifter-mod-lighten.minttyrc
ForegroundColour=171,171,171
BackgroundColour=0,0,0
CursorColour=253,157,79
Black=0,0,0
BoldBlack=52,52,52
Red=233,47,47
BoldRed=240,116,116
Green=14,216,57
BoldGreen=64,243,102
Yellow=221,221,19
@alvinthomas
alvinthomas / log.do
Last active Jan 23, 2017
Stata Log File with Date
View log.do
capture log close _all // Close any open log files
local cur date(c(current_date), "DMY") // Create a Date Object
local y = year(`cur') // Grab the year
local m = month(`cur') // Grab the month
local d = day(`cur') // Grab the day
if `m' < 10 {
local m = "0`m'" // Add a 0 to single-digit months
}
if `d' < 10 {
@alvinthomas
alvinthomas / .gitignore
Created Jan 23, 2017
Git Ignore file for Stata/R users
View .gitignore
*.dta
*.Rhistory
*.RData
*.RDataTmp
@alvinthomas
alvinthomas / bash-R.sh
Created Dec 20, 2016
Bash script for submitting R jobs on a Sun Grid Linux Cluster (like JHPCE at Johns Hopkins School of Public Health)
View bash-R.sh
#!/bin/bash -l
#$ -pe local 1
#$ -l mem_free=20G
#$ -l h_vmem=22G
#$ -m e
#$ -M EMAIL@jhmi.edu
#$ -o ofiles
#$ -e efiles
@alvinthomas
alvinthomas / bash-stata-mp.sh
Created Dec 20, 2016
Bash script for submitting Stata jobs on a Sun Grid Linux Cluster (like JHPCE at Johns Hopkins School of Public Health)
View bash-stata-mp.sh
#!/bin/bash -l
#$ -pe local 2
#$ -l mem_free=3G
#$ -l h_vmem=4G
#$ -m e
#$ -M EMAIL@jhmi.edu
#$ -e efiles
#$ -o ofiles
You can’t perform that action at this time.