Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile
@gadenbuie
gadenbuie / coffeeCream_functions.R
Last active August 29, 2015 13:57
Coffee and Cream Problem Simulation
# T.room # Temperature of the room
# T.coffee # Initial temperature of the coffee
# T.cream # Temperature of the cream
# k # Cooling rate constant
# T.d # Desired coffee temperature
temp <- function(T.init, T.room, k, x){
# Newton's cooling law temperature function
return(T.room + (T.init - T.room)*exp(-k*x))
}
@gadenbuie
gadenbuie / getCiteCounts.R
Last active November 1, 2015 05:24
Look up citation counts with rcrossref
getCiteCounts <- function(citekeys, bibtex){
## This function takes a list of citation keys, for ex. from lit review notes
## and a master bibtex file with citekeys and DOIs
## Returns a vector of number of times each article was cited from CrossRef
# Check for and load/install required packages
# --> stringr, rcrossref
if (!'stringr' %in% installed.packages()) install.packages('stringr')
require(stringr, quietly=TRUE)
@gadenbuie
gadenbuie / install-lnav.sh
Created November 13, 2015 16:56
Install lnav from GitHub source
#! /bin/bash
clone-lnav() {
echo "Downloading lnav..."
cd ~/Downloads
hash git &> /dev/null
if [ $? -eq 1 ]; then
sudo apt-get install git
fi
if [ $? -eq 0 ]; then
@gadenbuie
gadenbuie / usf-beamer-template.tex
Last active December 22, 2015 16:29
A USF College of Engineering Beamer Theme + Template Slides + Conference Presentation Framework
% University of South Florida College of Engineering Beamer Template
% Garrick Aden-Buie
% Send comments/beers to: gadenbuie@mail.usf.edu
% Example presentation:
% http://garrickadenbuie.com/wp-content/uploads/2013/09/usf-beamer-example.pdf
% IMPORTANT:
% If you want to use the USF logo, make sure you
% download the USF College of Engineering logo from:
@gadenbuie
gadenbuie / server.R
Last active January 4, 2016 19:59
Simple Linear First-Order Difference Equations for Cobweb Model (Shiny App)
library(shiny)
# s(k) = s(0) + b*p(k-1)
# d(k) = d(0) - a*p(k)
# p(k) = -b/a*p(k-1) + (d0-s0)/a
cobweb = function(params){
# Create data frame of prices, and supply and demand stocks
s0 = params[1]
@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({
reprex::reprex({
library(purrr)
l1 <- list(a = list(a1 = 1:10))
l2 <- list(a = list(a2 = 10:20))
list_merge(l1, l2)
#' But both `l1` and `l2` are named... so arguments should be named?
list_merge(x = l1, y = l2)
#' Oh, l2 is implicitly unnamed because it's in dots
list_merge(l1, y = l2)
#' But what I *really* wanted was this
reprex::reprex({
library(purrr)
l1 <- list(a = list(a1 = 1:10))
l2 <- list(a = list(a2 = 10:20))
list_merge(l1, l2)
#' But both `l1` and `l2` are named... so arguments should be named?
list_merge(x = l1, y = l2)
#' Oh, l2 is implicitly unnamed because it's in dots
list_merge(l1, y = l2)
#' But what I *really* wanted was this
library(purrr)
l1 <- list(a = list(a1 = 1:10))
l2 <- list(a = list(a2 = 10:20))
list_merge(l1, l2)
#' But both `l1` and `l2` are named... so arguments should be named?
list_merge(x = l1, y = l2)
#' Oh, l2 is implicitly unnamed because it's in dots
list_merge(l1, y = l2)
#' But what I *really* wanted was this
list_modify(l1, rlang::splice(l2))
---
output: github_document
---
# magick ![](http://www.textfiles.com/underconstruction/HeHeartlandPark2601underconstructionbar9.gif)
##### *Advanced Image-Processing in R*
[![Build Status](https://travis-ci.org/ropensci/magick.svg?branch=master)](https://travis-ci.org/ropensci/magick)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/ropensci/magick?branch=master&svg=true)](https://ci.appveyor.com/project/jeroen/magick)