Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/Rscript
get_nodes <- function(nodes = Sys.getenv("RSTUDIO_NODES")) {
unlist(strsplit(nodes, ",", fixed = TRUE))
}
get_health_check <- function(node_address) {
con <- url(sprintf("http://%s/health-check", node_address))
on.exit(close(con))
readLines(con)
@edavidaja
edavidaja / migrate-libraries.sh
Last active June 9, 2023 16:15
a script for users to run that migrates their package libraries on Workbench
#!/bin/bash
set -e
BCYAN='\033[1;36m'
BRED='\033[1;31m'
NC='\033[0m' # No Color
BOLD='\033[1m'
print_heading() {
echo ""
@edavidaja
edavidaja / r-fit-text.qmd
Created December 11, 2023 18:56
fit-text
---
format: revealjs
---
## purrr
::: r-fit-text
`map(.x, .f, ...)`
:::
@edavidaja
edavidaja / app.py
Created December 17, 2024 18:49
gradio
import gradio as gr
def get_user_info(text, request: gr.Request):
user_info = request.headers["RStudio-Connect-Credentials"]
return {
"user_info": user_info
}
demo = gr.Interface(get_user_info, "text", "json")
demo.launch()
@edavidaja
edavidaja / install.ps1
Created February 21, 2025 20:55
windows sandbox bootstrapping
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
scoop install git
scoop bucket add extras
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
scoop install rig