Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile
@gadenbuie
gadenbuie / server.R
Created September 1, 2016 15:17 — forked from daattali/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
@gadenbuie
gadenbuie / post-commit
Last active March 7, 2018 20:15 — forked from rmflight/post-commit
useful commit hooks for R package dev
#!/usr/bin/env Rscript
# License: CC0 (just be nice and point others to where you got this)
# Author: Robert M Flight <[email protected]>, github.com/rmflight
#
# This is a post-commit hook that after a successful commit subsequently increments the package version in DESCRIPTION
# and commits that. Analogous to the pre-commit at https://gist.github.com/rmflight/8863882, but useful if you only have
# good reasons for not doing it on the pre-commit.
#
# To install it, simply copy this into the ".git/hooks/post-commit" file of your git repo, change /path/2/Rscript, and make
@gadenbuie
gadenbuie / find-libs.R
Last active September 8, 2018 22:39 — forked from hrbrmstr/find-libs.R
find libraries used in your R scripts or Rmd documents
find_used_libraries <- function(path = getwd(), include_rmd = FALSE, by_file = FALSE) {
library(tidyverse)
if (!requireNamespace('sessioninfo', quietly = TRUE)) {
install.packages("sessioninfo")
library(sessioninfo)
}
library_pattern <- paste(
"(?:library|require)\\((.+?)\\)", # pkgs via library, require, etc.
"requireNamespace\\(['\"](.+?)['\"].+?\\)",
"([[:alnum:]_]+):{2,3}[[:alnum:]_]+", # pkgs via pkgname::function()

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@gadenbuie
gadenbuie / ggplot_tutorial.Rmd
Created September 24, 2018 19:04 — forked from emitanaka/ggplot_tutorial.Rmd
ggplot tutorial with kunoichi + ninjutsu xaringan theme
---
title: "ggplot tutorial"
subtitle: "with kunoichi + ninjutsu theme"
author: "<br><br> Emi Tanaka"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
nature:
@gadenbuie
gadenbuie / plot-it-all.R
Created October 18, 2018 02:54 — forked from EmilHvitfeldt/plot-it-all.R
Plot every since ggplot2 plot
library(ggplot2)
directory <- "~/Desktop/dataviz/"
fs::dir_create(directory)
print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, ...) {
set_last_plot(x)
if (newpage) grid::grid.newpage()
# Record dependency on 'ggplot2' on the display list
# (AFTER grid.newpage())
grDevices::recordGraphics(
@gadenbuie
gadenbuie / breaks_tutorial.Rmd
Last active November 30, 2018 15:46 — forked from EvaMaeRey/breaks_tutorial.Rmd
ggplot dplyr reveal breaking
---
title: "ggplot tutorial"
subtitle: "with Emi Tanaka's kunoichi + ninjutsu theme"
author: "<br><br>Gina Reynolds"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
chakra: libs/remark-latest.min.js
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
@gadenbuie
gadenbuie / pre-commit
Created December 18, 2018 22:29 — forked from jeroenjanssens/pre-commit
Script that tests your #rstats code before committing to git. When you have failed tests the commit will be aborted. Requires the devtools, testthat, and purrr packages. Name this script `pre-commit`, make it executable, and place it in the .git/hooks subdirectory of your git repository.
#!/usr/bin/env RScript
messages <- purrr::map_chr(devtools::test(),
list("results", 1, "message"))
q("no", status = sum(messages != "success"))
@gadenbuie
gadenbuie / shiny_modules_reactlog_not_independent
Last active July 12, 2019 14:36 — forked from sharlagelfand/shiny_modules_reactlog_not_independent
shiny modules + reactlog + not independent
options(shiny.reactlog = TRUE)
library(shiny)
library(reactlog)
mod_iris_ui <- function(id) {
ns <- NS(id)
tagList(
fluidRow(
column(
@gadenbuie
gadenbuie / app.R
Last active January 24, 2020 15:06 — forked from MayaGans/app.R
library(shiny)
# dummy list of dataframes
test <- data.frame("A" = NA, "B" = NA, "X" = NA)
test2 <- data.frame("D" = NA, "E" = NA, "F" = NA)
test3 <- data.frame("G" = NA, "H" = NA, "X" = NA)
combined_tests <- list(test = test, test2 = test2, test3 = test3)
# Turn list of dataframes into buckets of draggable blocks
rowBlock <- function(name) {