Skip to content

Instantly share code, notes, and snippets.

View trestletech's full-sized avatar

Jeff Allen trestletech

View GitHub Profile
@trestletech
trestletech / integration-testing.Rmd
Last active November 4, 2019 15:41
Integration testing vignette for the Shiny Dev center.
---
title: "Integration Testing in Shiny"
output: github_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@trestletech
trestletech / Vagrantfile
Last active September 24, 2019 20:49
Ubuntu 18.04 Vagrantfile with RStudio Desktop installed and arbitrary version of R (via r-builds). user/pass is `vagrant:vagrant`
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)

Keybase proof

I hereby claim:

  • I am trestletech on github.
  • I am trestletech (https://keybase.io/trestletech) on keybase.
  • I have a public key whose fingerprint is DC6E 66E5 1FD7 E7DD 48F3 30DC F444 9D7D 7C8B 4C37

To claim this, I am signing this object:

@trestletech
trestletech / analysis.R
Last active July 7, 2017 16:49
Tidying of pressure-sensitive keystroke dynamics data. Raw available: https://figshare.com/articles/Pressure-sensitive_keystroke_dynamics_data/5170705 . The `isJA` column represents whether or not the user currently typing is "Jeffrey Allen" -- i.e. is the user typing his own name (TRUE) or someone else's (FALSE)?
download.file("https://ndownloader.figshare.com/articles/5170705/versions/1", "kd.zip")
unzip("kd.zip")
library(readr)
words <- readr::read_csv("KSP-Word.csv")
users <- readr::read_csv("KSP-User.csv")
entries <- readr::read_csv("KSP-Entry.csv")
keypress <- readr::read_csv("KSP-KeyPress.csv")
pressure <- readr::read_csv("KSP-Pressure.csv")
@trestletech
trestletech / instance-types.sh
Created June 15, 2016 16:41
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
@trestletech
trestletech / .gitignore
Last active June 2, 2016 16:44
node-authenticate-pam crash
node_modules
.vagrant
*.swp
@trestletech
trestletech / enc.R
Created January 19, 2016 15:45
encrypting arbitrary amounts of data in R using PKI
library(PKI)
txt <- ("This is an encryption test that has a variety of characters and is fairly long so that we can test whether or not it's actually using the stream cipher")
corpus <- paste(rep(txt, 5000), collapse="")
x <- charToRaw(corpus)
length(x)
key <- PKI.digest(charToRaw("this is a small key but it's getting bigger by the second"), "SHA256")
ae <- PKI.encrypt(x, key, "aes256")
ad <- PKI.decrypt(ae, key, "aes256")
stopifnot(identical(x, ad))
stopifnot(!identical(ad, ae))
# Suppose a function has an argument "x". If a "child function" has multiple
# argument beginning with "x" and I want to pass the param "x" to its parent,
# I get error: `argument n matches multiple formal arguments`
# The reason this happens is clear, but at 3am my brain is firing blanks
# trying to find a solution. Help!
library(magrittr)
foo <- function(x, ...) UseMethod("foo")
foo.parent <- function(x, n = 5, ...) n
FROM ubuntu:14.04
MAINTAINER Winston Chang "winston@rstudio.com"
# =====================================================================
# R
# =====================================================================
# Need this to add R repo
RUN apt-get update && apt-get install -y software-properties-common