Skip to content

Instantly share code, notes, and snippets.

Curtis Alexander curtisalexander

Block or report user

Report or block curtisalexander

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fsharp-httpclient.fsx
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 Jan 26, 2019 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
View boxstarter.ps1
# 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
View keybase.md

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 Mar 3, 2018
Install openssl from source to the global library, with the appropriate configuration variables
View install_openssl_R_pkgs.sh
#!/usr/bin/env zsh
# where to begin?
DIR="${HOME}/code"
cd "${DIR}"
echo
echo "Working from within ${PWD}"
echo
View rmarkdown-with-alt-langs-example
---
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 Nov 14, 2017
Run rmarkdown::render() when files that match a pattern change within a directory
View _watch-render-rmd.R
#!/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 Nov 26, 2017
Windows batch file to accompany _watch-render-site or _watch-render-rmd in lieu of a *nix shebang
View _watch-render.bat
@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 Nov 26, 2017
Run rmarkdown::render_site() when files that match a pattern change within a directory
View _watch-render-site.R
#!/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 Jan 29, 2018
Use R to kill tasks on Windows
View taskkill-pipeline.R
# 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 Jan 29, 2018
Use R to kill tasks on Windows
View taskkill.R
# install (if applicable)
# install.packages(c("dplyr",
# "processx",
# "purrr",
# "readr"))
# libraries
suppressWarnings(suppressMessages(library("dplyr")))
suppressWarnings(suppressMessages(library("processx")))
suppressWarnings(suppressMessages(library("purrr")))
You can’t perform that action at this time.