Skip to content

Instantly share code, notes, and snippets.

View sellorm's full-sized avatar
🥑

Mark Sellors sellorm

🥑
View GitHub Profile
@sellorm
sellorm / render_with_jobs.R
Created April 15, 2021 20:54
Render an Rmarkdown document in the RStudio jobs pane.
render_with_jobs <- function(){
rstudioapi::verifyAvailable()
jobs_file <- tempfile(tmpdir = "/tmp", fileext = ".R")
rmd_to_render <- rstudioapi::selectFile(caption = "Choose an Rmd file...",
filter = "Rmd files (*.Rmd)")
if (is.null(rmd_to_render)){
stop("You must choose an Rmd file to proceed!")
}
cat(paste0('rmarkdown::render("', rmd_to_render, '")'), file = jobs_file)
rstudioapi::jobRunScript(path = jobs_file,

Keybase proof

I hereby claim:

  • I am sellorm on github.
  • I am sellorm (https://keybase.io/sellorm) on keybase.
  • I have a public key ASDECIl3NPyPJHFpyBr-tLGHvRa3jyK83ivKXwJqaYWosgo

To claim this, I am signing this object:

#!/usr/bin/env Rscript
library(rvest)
futile.logger::flog.info('starting...')
futile.logger::flog.info('checking website')
ubuntu_dailies <- read_html("https://dailies.rstudio.com/rstudioserver/oss/ubuntu/amd64/")
futile.logger::flog.info('extracting url')
ubuntu_latest <- ubuntu_dailies %>%
html_nodes(".filename a") %>%
html_attr("href")
# run unique baby names from the babynames package through the sorting hat
# used in http://blog.sellorm.com/2017/12/21/command-line-utilities-in-r-pt-4/
# to check the distribution of results
# house lookup ------------------------------------------------------------
houses <- c("0" = "Hufflepuff",
"1" = "Gryffindor",
"2" = "Ravenclaw",
"3" = "Slytherin",
"4" = "Hufflepuff",
#!/usr/bin/env bash
pkg=${1}
function help {
echo "Usage: $(basename $0) <package name>"
exit 1
}
[ -z ${pkg} ] && help

Keybase proof

I hereby claim:

  • I am sellorm on github.
  • I am sellorm (https://keybase.io/sellorm) on keybase.
  • I have a public key whose fingerprint is 2658 09C5 814D 03A6 2DFD 675C 493E 8DC0 3C89 E290

To claim this, I am signing this object:

@sellorm
sellorm / plumberStart.R
Last active September 22, 2017 16:10
A quick script, written in R, to launch API's written using the plumber package for R. Don't forget to 'chmod +x plumberStart.R'. Usage should be 'plumberStart.R /path/to/plumber/file.R <port>', if port is omitted, the script will use 8080 as a default
#!/usr/bin/env Rscript
args <- commandArgs(trailingOnly = TRUE)
if (is.na(args[1])) {
cat('Missing file name\n')
q('no')
} else {
file <- args[1]
}
if (is.na(args[2])) {
cat('No port specified - defaulting to 8080\n')
@sellorm
sellorm / slackUserLookup.py
Last active August 29, 2015 14:05
A quick utility to map local email usernames to slack.com names
#!/usr/bin/env python
import sys
import simplejson as json
from urlgrabber import urlread
slackAPIToken = '<your API key here>'
emailDomain = '<your domain name here>'
try:
lookupName = sys.argv[1]