Skip to content

Instantly share code, notes, and snippets.

View srvanderplas's full-sized avatar

Susan VanderPlas srvanderplas

View GitHub Profile
@srvanderplas
srvanderplas / Examples.R
Last active April 20, 2022 14:50
Plotting with images
library(ggplot2)
library(dplyr)
library(stringr) # string manipulation
library(readr) # parse_number
library(magrittr) # pipe and set_names function
if(!"ggimage" %in% installed.packages()) {
install.packages("ggimage")
}
@srvanderplas
srvanderplas / Data Sources.md
Last active October 18, 2023 19:08
Useful Short Notes
@srvanderplas
srvanderplas / ghcfix.sh
Created September 15, 2023 14:56
Script to fix up github classroom repositories, pull changes, and compile quarto homework files
#!/bin/bash
while getopts r::pvf OPT
do
case "$OPT" in
r) FILE="$OPTARG" # RENDER files with quarto
RENDER=1;;
v) VERBOSE=1;; # VERBOSE - print everything
p) PULL=1;; # Pull new changes
f) FIX=1;; # Fix github repo
esac
@srvanderplas
srvanderplas / Rpkginstall
Created May 2, 2024 15:00
Install all R packages loaded in any files within a folder
#!/bin/bash
# This concatenates array values using a multi-character separater.
# https://dev.to/meleu/how-to-join-array-elements-in-a-bash-script-303a
joinByString() {
local separator="$1"
shift
local first="$1"
shift
printf "%s" "$first" "${@/#/$separator}"
@srvanderplas
srvanderplas / compile-to-3mf.sh
Created August 29, 2025 13:14
Script to compile a multi-color OpenSCAD file to a 3mf file using colorscad.sh
#!/bin/bash
# Requires https://github.com/jschobben/colorscad to be somewhere on the path
for m in {1..15}
do
file="multiplication/$(printf '%02dx.scad' ${m})"
cp spinner-multiplication.scad $file
#awk -v a="m=${m};" 'NR==3 { sub(".*insert-m-here", a) }' $file
sed -E -i "3s/.*/m=${m};/" $file
colorscad.sh -i "$file" -o "${file%.scad}.3mf" -f