Skip to content

Instantly share code, notes, and snippets.

View DaveParr's full-sized avatar

Dave Parr DaveParr

View GitHub Profile
@dsparks
dsparks / LineFinder.R
Created February 9, 2011 18:36
locates a string in a vector of strings
lineFinder <- function(string, vector){ (1:length(vector))[regexpr(string, vector) != -1] }
@dsparks
dsparks / MakeTable.R
Created February 9, 2011 18:37
helper function for parsing text
makeTable <- function(vector, toregex){ do.call(rbind, strsplit(vector, toregex)) }
@dsparks
dsparks / pokePlot.R
Created October 13, 2012 06:13
Ridiculous Pokemon plot
# Truly the most ridiculous thing I could think of.
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("XML", "png", "devtools", "RCurl")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Some helper functions, lineFinder and makeTable
source_gist("818983")
source_gist("818986")
@nassimhaddad
nassimhaddad / footnote_ggplot2.r
Created April 1, 2014 15:08
add footnote to ggplot chart
# source: http://bigdata-analyst.com/best-way-to-add-a-footnote-to-a-plot-created-with-ggplot2.html
library(gridExtra)
g <- arrangeGrob(p, sub = textGrob("Footnote", x = 0, hjust = -0.1, vjust=0.1, gp = gpar(fontface = "italic", fontsize = 18)))
@stephlocke
stephlocke / miniCRAN.R
Last active January 19, 2017 09:19
Getting a local CRAN that combines internal and external packages
## ------------------------------------------------------------------------
# Set the repo for use throughout
cran <- "https://cran.rstudio.org"
# Install
if(!require(miniCRAN)){
install.packages("miniCRAN", repos = cran)
}
## ------------------------------------------------------------------------
@itod
itod / split_keyboards.md
Last active May 30, 2024 06:46
Every "split" mechanical keyboard currently being sold that I know of
# shell
sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
# ~/.R/Makevars
F77 = /usr/local/gfortran/bin/gfortran
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CC=ccache /usr/local/opt/gcc/bin/gcc-6 -Wunused-argument
CXX=ccache /usr/local/opt/gcc/bin/g++-6 -Wunused-argument
@m8r1x
m8r1x / .gitlab-ci.yml
Created December 11, 2017 20:01 — forked from abdullah353/.gitlab-ci.yml
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH # Required for awscli.
- aws --version # Print out aws cli version for debugging.
@tylermorganwall
tylermorganwall / cholera_snow.R
Last active November 5, 2020 23:34
John Snow's cholera clusters, visualized in 3D with rayshader and ggplot2
#theme and ggplot derived from David Kretch, his code: https://github.com/davidkretch/london_cholera_map/blob/master/london_cholera_map.R
library(HistData)
library(ggplot2)
library(ggpointdensity)
library(rayshader)
deaths = Snow.deaths
streets = Snow.streets
// Hiking Log
//
// The main LED is used to communicate status. Under normal operation, when board is reset, the following sequence of blinks will indicate normal operation:
// 1. Three 0.5 second pulses indicate that a card is present.
// 2. A single one-second pulse indicates that commands have been sent to the GPS module.
// 3. The LED will turn off. No more pulses will be emitted unless there is an error condition.
//
// During normal operation, the device appends a single line to the LOG.CSV file every minute, on the minute.
// You may safely remove the SD card anytime other than the one-minute mark, as that's the only time the file is open.
//