Skip to content

Instantly share code, notes, and snippets.

View curtisalexander's full-sized avatar

Curtis Alexander curtisalexander

  • Fayetteville, AR
  • 12:39 (UTC -06:00)
View GitHub Profile
open System.Net.Http
open System.IO
let downloadDataWithHttpClient (url: string) =
async {
use hc = new HttpClient()
// Just read the header
let! response = hc.GetAsync(url, HttpCompletionOption.ResponseHeadersRead) |> Async.AwaitTask
// if response.IsSuccessStatusCode
let filename = Path.GetTempFileName()
@curtisalexander
curtisalexander / boxstarter.ps1
Last active January 26, 2019 16:06 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: curtisalexander, forked from jessfraz
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/nr/url?<URL-TO-RAW-GIST>
# OR
# Install-BoxstarterPackage -PackageName <URL-TO-RAW-GIST> -DisableReboots
#
# Learn more: http://boxstarter.org/Learn/WebLauncher

Keybase proof

I hereby claim:

  • I am curtisalexander on github.
  • I am calex (https://keybase.io/calex) on keybase.
  • I have a public key whose fingerprint is 095A 82B6 0C23 C6B6 966B 4FC1 9551 294F 845B BAE6

To claim this, I am signing this object:

@curtisalexander
curtisalexander / install_openssl_R_pkgs.sh
Last active March 3, 2018 20:30
Install openssl from source to the global library, with the appropriate configuration variables
#!/usr/bin/env zsh
# where to begin?
DIR="${HOME}/code"
cd "${DIR}"
echo
echo "Working from within ${PWD}"
echo
---
title: "R Markdown with Alternate Languages"
author: "Curtis Alexander"
output:
html_document:
include:
in_header: header.html
mathjax: null
params:
hilang:
@curtisalexander
curtisalexander / _watch-render-rmd.R
Last active November 14, 2017 21:18
Run rmarkdown::render() when files that match a pattern change within a directory
#!/usr/local/bin/Rscript --no-site-file --no-init-file --no-restore
# --vanilla ==> --no-site-file --no-init-file --no-restore --no-environ
# thus the above reads the .Renviron file(s)
## required packages ==
# install.packages(c("docopt",
# "testthat"))
## docopt.org ==
@curtisalexander
curtisalexander / _watch-render.bat
Last active November 26, 2017 12:50
Windows batch file to accompany _watch-render-site or _watch-render-rmd in lieu of a *nix shebang
@echo off
cls
C:
PATH C:\Program Files\R\R~\bin;%PATH%
:: pushd required in the event that the _watch-render-site.R or
:: _watch-render-rmd.R script is on a network drive
@pushd %~dp0
:: reads .Renviron as it sets the environment variable RSTUDIO_PANDOC
:: which is the PATH to pandoc
cmd /c Rscript --no-site-file --no-init-file --no-restore _watch-render.R --patt=".+\.Rmd"
@curtisalexander
curtisalexander / _watch-render-site.R
Last active November 26, 2017 12:43
Run rmarkdown::render_site() when files that match a pattern change within a directory
#!/usr/local/bin/Rscript --no-site-file --no-init-file --no-restore
# --vanilla ==> --no-site-file --no-init-file --no-restore --no-environ
# thus the above reads the .Renviron file(s)
## required packages ==
# install.packages(c("docopt",
# "testthat"))
## docopt.org ==
@curtisalexander
curtisalexander / taskkill-pipeline.R
Last active January 29, 2018 22:33
Use R to kill tasks on Windows
# for checking and installing packages
# extracted from CRAmisc package
# https://github.com/curtisalexander/CRAmisc/blob/master/R/install.R
check_install <- function(pkgs, repos = NULL, ...) {
installed_packages <- installed.packages()[ ,1]
for (i in seq_along(pkgs)) {
pkg <- pkgs[[i]]
if (!pkg %in% installed_packages) {
cat(paste0("Need to install: ", pkg, "\n"))
if(is.null(repos)) install.packages(pkg, repos = "https://cran.rstudio.com")
@curtisalexander
curtisalexander / taskkill.R
Last active January 29, 2018 22:28
Use R to kill tasks on Windows
# install (if applicable)
# install.packages(c("dplyr",
# "processx",
# "purrr",
# "readr"))
# libraries
suppressWarnings(suppressMessages(library("dplyr")))
suppressWarnings(suppressMessages(library("processx")))
suppressWarnings(suppressMessages(library("purrr")))