Skip to content

Instantly share code, notes, and snippets.

View dpastoor's full-sized avatar

Devin Pastoor dpastoor

  • A2-Ai
  • Rockville, MD
View GitHub Profile
@dpastoor
dpastoor / add-local-bin.sh
Last active August 24, 2023 16:56
add-local-bin
#!/bin/bash
# Check if ~/.local/bin directory exists, if not, create it
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
echo "Created ~/.local/bin directory"
fi
# Check if ~/.profile file exists, if not, create it and add ~/.local/bin to PATH
if [ ! -f "$HOME/.profile" ]; then
@dpastoor
dpastoor / configapp.R
Last active July 3, 2023 18:34
configure metworx workflow
if (!requireNamespace("miniUI", quietly = TRUE)) {
message("installing miniUI so can run config app")
install.packages("miniUI")
}
if (!requireNamespace("gert", quietly = TRUE)) {
message("installing gert so can run config app")
install.packages("gert")
}
library(shiny)
library(miniUI)
@dpastoor
dpastoor / add-github-user.sh
Last active December 29, 2022 18:57
misc user creation
#!/bin/bash
set -eux
USER=$1
PW=$2
if id -u "$USER" &>/dev/null; then
echo "$USER already created, going to next..."
exit 0;
@dpastoor
dpastoor / gist:1d587c48351ef99b7dabf7959b007366
Created December 29, 2022 18:53
update-workbench-daily
#!/bin/bash
set -ex
DEBIAN_FRONTEND=noninteractive
rstudio-server stop
rstudio-launcher stop
JSON=$(curl -s https://dailies.rstudio.com/rstudio/latest/index.json)
# its bionic for both ubuntu 18 and 20
DIST_JSON=$(echo "${JSON}" | jq .products.workbench.platforms['"'"bionic-amd64"'"'])
@dpastoor
dpastoor / update-workbench-ubuntu.sh
Created December 3, 2022 19:53
update-workbench-daily
#!/bin/bash
set -ex
DEBIAN_FRONTEND=noninteractive
rstudio-server stop
rstudio-launcher stop
JSON=$(curl -s https://dailies.rstudio.com/rstudio/latest/index.json)
DIST_JSON=$(echo "${JSON}" | jq .products.workbench.platforms['"'"bionic-amd64"'"'])
LATEST_URL=$(echo "${DIST_JSON}" | jq -r '.link')
@dpastoor
dpastoor / gh.sh
Last active November 11, 2022 15:58
bootstrap-tailscale-vm
type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
@dpastoor
dpastoor / query.gql
Last active July 3, 2022 19:51
query starred repos
# Type queries into this side of the screen, and you will
# see intelligent typeaheads aware of the current GraphQL type schema,
# live syntax, and validation errors highlighted within the text.
# We'll get you started with a simple query showing your username!
query {
viewer {
login
name
starredRepositories(first: 5, orderBy: {
@dpastoor
dpastoor / update_quarto_mac.sh
Created March 11, 2022 14:51
quarto updates
#!/bin/bash
set -ex
curl -s https://api.github.com/repos/quarto-dev/quarto-cli/releases/latest |
jq '.assets[] | select(.name | contains("macos.pkg")) | .browser_download_url' |
xargs curl -o /tmp/quarto.pkg -L
installer -pkg /tmp/quarto.pkg -target CurrentUserHomeDirectory
@dpastoor
dpastoor / forestplotexample
Created August 14, 2013 15:02
Example forest plot using ggplot2
library(ggplot2)
dat <- data.frame(group = factor(c("Infliximab","Etanercept","Adalimumab","Golimumab","Certolizumab","Abatacept","Rituximab","Tocilizumab","Total"),
levels=c("Total","Certolizumab","Golimumab","Adalimumab","Etanercept","Infliximab","Tocilizumab","Rituximab","Abatacept")),
cen = c(1.88,2.67,2.35,2.14,5.08,1.68,2.11,2.01,2.16),
low = c(1.01,1.44,1.52,1.59,3.46,1.47,1.64,1.57,1.83),
high = c(3.51,4.94,3.65,2.89,7.48,1.90,2.72,2.57,2.55))
@dpastoor
dpastoor / copy_to_userdir.sh
Last active December 6, 2019 17:15
adding users
users=`ls /data/home/`
folder="FOLDER"
for i in $users; do
echo "Copying to $i"
cp -R /data/$folder /home/$i/
rm -rf /home/$i/$folder/.git
rm -rf /home/$i/$folder/.Rproj.user
chown -R $i: /home/$i/$folder
done