Skip to content

Instantly share code, notes, and snippets.

View alvinthomas's full-sized avatar

Alvin Thomas alvinthomas

View GitHub Profile
@alvinthomas
alvinthomas / bash-stata-mp.sh
Created December 20, 2016 15:51
Bash script for submitting Stata jobs on a Sun Grid Linux Cluster (like JHPCE at Johns Hopkins School of Public Health)
#!/bin/bash -l
#$ -pe local 2
#$ -l mem_free=3G
#$ -l h_vmem=4G
#$ -m e
#$ -M EMAIL@jhmi.edu
#$ -e efiles
#$ -o ofiles
@alvinthomas
alvinthomas / bash-R.sh
Created December 20, 2016 16:39
Bash script for submitting R jobs on a Sun Grid Linux Cluster (like JHPCE at Johns Hopkins School of Public Health)
#!/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 / .gitignore
Created January 23, 2017 16:16
Git Ignore file for Stata/R users
*.dta
*.Rhistory
*.RData
*.RDataTmp
@alvinthomas
alvinthomas / log.do
Last active July 10, 2021 15:07
Stata Log File with Date
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 / base16-shapeshifter-mod-lighten.minttyrc
Created March 10, 2017 19:49
Copy of Base-16 Shapeshifter Theme for Mintty from https://github.com/oumu/mintty-color-schemes and Personal Mintty RC
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 / _config.yml
Created June 29, 2017 18:29
Re-direct to statsnips
theme: jekyll-theme-minimal
gems:
- jekyll-redirect-to
@alvinthomas
alvinthomas / dockerfile
Created October 28, 2019 20:15
dockerfile_example_20191028
FROM rocker/tidyverse
RUN Rscript -e "install.packages(c('tidytext', 'gutenbergr'))"
@alvinthomas
alvinthomas / hgwells_wordcounts2.R
Created October 28, 2019 20:30
Gutenbergr and tidytext example with write_csv()
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 / run_docker_example.sh
Created October 28, 2019 22:55
Small bash script to run docker_example (see docker_example.sh)
#!/usr/bin/env bash
docker run --rm -d -v $(pwd):$(pwd) -w $(pwd) docker_example Rscript hgwells_wordcounts2.R
@alvinthomas
alvinthomas / docker_example.sh
Created October 28, 2019 22:57
An example using a modified docker tidyverse to output a list
#!/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 .