Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile
@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 <rflight79@gmail.com>, 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
---
title: regextest notes
output:
html_document:
css: inst/style.css
keep_md: yes
---
```{r setup, include=FALSE}
library(purrr)
@gadenbuie
gadenbuie / directoryIndex.html
Last active April 23, 2018 01:57
My Shiny directory index template
<!DOCTYPE html>
<html>
<head>
<title>{{title}}</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<!-- <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/base-min.css"> -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
@gadenbuie
gadenbuie / basic_miniUI_gadget.R
Created April 24, 2018 13:14
A basic miniUI Shiny gadget
#' Basic miniUI Gadget Function
#'
#' Single view with button row along the bottom
basic_miniUI_gadget <- function() {
require(shiny)
require(miniUI)
ui <- miniPage(
gadgetTitleBar("Shiny gadget example"),
miniContentPanel(
#' Create a public Github gist and send to carbon.now.sh, then browse to both.
#'
#' Create a public Github gist and browse to it, then open the gist in
#' [carbon.now.sh](https://carbon.now.sh), for easily Tweeting a saucy code pic.
#' The gist will contain the active text selection or the active RStudio tab.
#' Gist file is named: `RStudio_<project>_<filename or file_id>`. `file_id` is
#' a unique id for untitled files. It does not relate to the untitled number.
#' @return nothing.
#' @export
gistfoc <- function() gistfo_base(mode = "carbon")

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"),