This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This processes figures for STAT guidelines... | |
library(tidyverse) | |
library(stringr) | |
# --- Pull out all figure captions and reference names --- | |
chunks <- readLines("index.tex") | |
figures_start <- which(str_detect(chunks, "\\\\begin.figure.")) | |
figures_end <- which(str_detect(chunks, "\\\\end.figure.")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bunch and Murphy simulation | |
library(tidyverse) | |
# Packet 1 contains 10 fires from the same weapon | |
# Packet 2 contains 1 from each of the other 9 glocks, plus one non-glock | |
# Packets 3-8 contain | |
# - 0, 1, or 2 non-glocks | |
# - 10, 9, or 8 randomly sampled from each of the other glocks | |
# After packet 2 is assembled, then, the following cartridges remain: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/Rscript | |
# Scrape Southwest Power Pool LMP/SMP/MCC | |
library(scrapeR) | |
library(stringr) | |
library(lubridate) | |
library(ggplot2) | |
library(RMySQL) | |
library(plyr) | |
library(reshape2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This uses GNU parallel: cite: | |
# @article{Tange2011a, | |
# title = {GNU Parallel - The Command-Line Power Tool}, | |
# author = {O. Tange}, | |
# address = {Frederiksberg, Denmark}, | |
# journal = {;login: The USENIX Magazine}, | |
# month = {Feb}, | |
# number = {1}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(reticulate) | |
library(tidyverse) | |
library(stringr) | |
library(imager) | |
main <- import_main() | |
cv2 <- import("cv2", as = "cv2") | |
source_python("./inst/HoughLines.py") | |
chunk_edges <- list.files("inst/processed/slices/", pattern = "_edge", full.names = T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in *.stl; | |
do T=__tmp__$i; | |
b=`basename $i`; | |
echo import\(\"$i\"\)\; | |
>$T; | |
openscad -o $b.png --render --colorscheme=Nature --camera0,0,0,30,-30,0 --imgsize=600,600 --projection=o $T; | |
rm $T; | |
done |
NewerOlder