Skip to content

Instantly share code, notes, and snippets.

View jgilfillan's full-sized avatar

Josh Gilfillan jgilfillan

View GitHub Profile
# ensure python 3 is installed
cd ~
mkdir dbt-envs
cd dbt-envs
python -m venv dbt-env
.\dbt-env\Scripts\activate
# install dbt-core
git clone https://github.com/dbt-labs/dbt-core.git
@jgilfillan
jgilfillan / boxstarter.ps1
Last active January 19, 2022 08:57
Boxstarter Standard Setup
#####################
# PREREQUISITES
#####################
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-TaskbarSmall
# Console
cinst microsoft-windows-terminal
@jgilfillan
jgilfillan / hash.R
Last active June 28, 2017 00:13
Hash functions in R
install.packages("openssl")
library("openssl")
sha256("string", "salt")
# [1] "239ad6643604e44320c7f1c99809432e00ff26f90bff04bed0612a618dd045b7"
@jgilfillan
jgilfillan / scale_fill_griffith.R
Created February 12, 2017 21:04
Griffith ggplot2 palettes
scale_fill_griffith <- function(theme="uni_groups", tech_key = list(
uni_groups = c("#c12525", "#6F2C91", "#F36F21", "#00AEEF", "#50B848"), # GU, AEL, BUS, HTH, SCG
groups = c("#6F2C91", "#F36F21", "#00AEEF", "#50B848"), # AEL, BUS, HTH, SCG
gu_nat = c("#c12525", "#989898"), # GU, National
gu_qut_uq = c("#c12525", "#1f77b4", "#9467bd"), # GU, National
gu_uq_qut = c("#c12525", "#9467bd", "#1f77b4") # GU, National
)) {
scale_fill_manual(values=tech_key[[theme]])
@jgilfillan
jgilfillan / cumsum_with_reset.R
Created February 3, 2017 12:44
Cumulative sum in R with reset after reaching threshold
testvector <- c(.5, .1, .2, .9, .9, .2, .5)
# group rows based on cumsum with reset
cumsum_group <- function(x, threshold) {
cumsum <- 0
group <- 1
result <- numeric()
for (i in 1:length(x)) {
cumsum <- cumsum + x[i]
@jgilfillan
jgilfillan / _vimrc
Last active February 20, 2016 19:19
set nocompatible " be iMproved, required
"-----START Vundle Config------
filetype off " required
" check if windows or linux and set the runtime path to include Vundle and initialize
if has('win32')
set rtp+=~/vimfiles/bundle/Vundle.vim/
au GUIEnter * simalt ~x "start maximised
elseif has('unix')
@jgilfillan
jgilfillan / RHeader.r
Created August 19, 2015 03:52
R include to be run at the top of each R script.
###################################################################################################
#
# Descr: This is a standard header script to be run at the beginning of each R script
# It loads the standard packages and a password prompt function
# Usage: At the top of the r script, place the following text:
# source("[PATH TO RHeader.r]\\RHeader.r")
# Author: Josh Gilfillan
# Date: 20150326
#
###################################################################################################
@jgilfillan
jgilfillan / install ROracle on Windows.md
Last active December 21, 2021 17:35
Instructions on how to install ROracle for R on Windows.
@jgilfillan
jgilfillan / mapshaper data join and simplify
Created October 1, 2014 10:51
use mapshaper to add extra properties, simplify the file and output to topojson format
# original shapefile from http://www.abs.gov.au/AUSSTATS/abs@.nsf/DetailsPage/1270.0.55.003July%202011
# Postal Areas ASGS Non ABS Structures Ed 2011 Digital Boundaries in ESRI Shapefile Format
# -i specifies input file
# -join specifies csv to join and join key
# -simplify speficies simplification percentage
# -o specifies outfile file and format
# full set of command lines options here: https://github.com/mbloch/mapshaper/wiki/Command-Reference
@jgilfillan
jgilfillan / data.csv
Last active August 29, 2015 14:05
Diverging Bar Chart
GRM_FTE rtrn_yr fte Gender
1 2005 1 M
1 2006 1 F
1 2007 1 M
1 2008 1 M
1 2006 1 M
0.5 2007 0.5 M
1 2008 1 F
1 2009 1 M
1 2010 1 F