Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile

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 / find_blogdown_tags.R
Created April 30, 2018 00:44
Script to find, count and list all tags in blogdown posts
# Find, count and list all tags in blogdown posts
# Scan yaml of all posts (run at root of blogdown project)
blogdown:::scan_yaml() %>%
# Pull out the tags
purrr::map("tags") %>%
# Drop results without any tags
purrr::discard(is.null) %>%
# Turn into a nice tibble (can stop here if you want tags + files)
purrr::map_df(~ tibble::data_frame(tags = .), .id = "file") %>%
dplyr::mutate()
dplyr:::accumulate()
i == 1:10
i <- 1:10
i <<- 1:10
@gadenbuie
gadenbuie / README_to_vignette.R
Last active May 8, 2018 18:58
Convert an existing `README.Rmd` into a vignette
#' Convert an existing `README.Rmd` into a vignette
#'
#' While many package lack vignettes, they often contain useful information in
#' the form of a `README.Rmd` file which could in theory form a first draft of a
#' vignette. This function attempts to convert the `README.Rmd` file into a
#' passable vignette, leveraging the same internals as [use_vignette()]. Once
#' created, an attempt is made to open the file for further editing.
#'
#' This is not guaranteed to create a complete vignette ready to be knit, it
#' just does the easy part. Relative file paths will still need to be updated.
```{r xaringan-themer, include=FALSE}
library(xaringanthemer)
rladies_base <- "#562457"
rladies_lighter <- "#88398A"
mono_accent(
base_color = rladies_base,
link_color = rladies_lighter,
code_inline_color = rladies_lighter,
code_highlight_color = "rgba(136, 57, 138, 0.3)",
text_font_google = google_font("Lato"),
```{r xaringan-themer, include=FALSE}
library(xaringanthemer)
mono_accent(
base_color = "#175dac",
title_slide_text_color = "#175dac",
title_slide_background_color = "white",
title_slide_background_image = "Rlogo.svg",
title_slide_background_position = "90% 90%",
title_slide_background_size = "200px",
text_font_size = "24px",
mutate(
df,
var = recode_if(var, in_group_1, "old1" = "new1"),
var = recode_if(var, in_group_2, "0" = "A", "1" = "B", "2" = "C", "3" = "D"),
var = recode_if(var, in_group_3, "a" = "A", "b" = "B", "c" = "C")
)
mutate(
df,
var = case_when(
url_git_io <- function(url) {
if (!requireNamespace("curl", quietly = TRUE)) return(url)
h <- curl::new_handle()
curl::handle_setform(h, url = url)
r <- curl::curl_fetch_memory("https://git.io", h)
if (!r$status %in% 200:203) return(url)
curl::parse_headers_list(r$headers)$location
}
# https://git.io/fNiD6
@gadenbuie
gadenbuie / join-animations-with-gganimate.R
Last active January 11, 2022 15:48
Animated dplyr joins with gganimate
# Animated dplyr joins with gganimate
# * Garrick Aden-Buie
# * garrickadenbuie.com
# * MIT License: https://opensource.org/licenses/MIT
# Note: I used Fira Sans and Fira Mono fonts.
# Use search and replace to use a different font if Fira is not available.
library(tidyverse)
library(gganimate)
@gadenbuie
gadenbuie / xaringan-decouple-code-plot.Rmd
Last active November 22, 2021 16:54
Decouple code and plots (or results) in xaringan slides
---
title: "Decouple Code and Output in xaringan slides"
subtitle: "Demo Slides for <a href='https://garrickadenbuie.com/blog/2018/08/14/decouple-code-and-output-in-xaringan-slides/'>Related Blog Post</a>"
author: "Garrick Aden-Buie"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: libs
nature:
ratio: 16:9