Skip to content

Instantly share code, notes, and snippets.

@arraytools
arraytools / shiny-examples.Rmd
Created September 6, 2022 13:17
create a table of URL links to shiny examples (https://github.com/rstudio/shiny-examples)
---
title: " "
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(dplyr)
library(knitr)
library(kableExtra)
@arraytools
arraytools / docker-compose.yml
Last active October 10, 2022 13:36
Grafana using docker
version: '3.3'
services:
node-exporter:
image: quay.io/prometheus/node-exporter:latest
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
@arraytools
arraytools / renv_restore.log
Created January 23, 2023 03:03
Output log from calling renv::restore() on a new computer. This is testing on Ubuntu 22.04, renv 0.16.0.
> renv::restore()
Welcome to renv!
It looks like this is your first time using renv. This is a one-time message,
briefly describing some of renv's functionality.
renv maintains a local cache of data on the filesystem, located at:
- "~/.cache/R/renv"
@arraytools
arraytools / vibrant_mine.rstheme
Created May 29, 2023 15:30
Vibrant Ink SB 2 theme for RStudio
/* rs-theme-name: Vibrant Ink SB 2 */
/* rs-theme-is-dark: TRUE */
.ace_gutter {
background: #1a1a1a;
color: #BEBEBE
}
.ace_print-margin {
width: 1px;
background: #444;
}
@arraytools
arraytools / smart_pny1t.txt
Last active August 15, 2023 01:24
smart from a brand new 1T PNY SSD
$ sudo smartctl -a /dev/sdb
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.19.0-46-generic] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Device Model: PNY CS900 1TB SSD
Serial Number: PNY231123031701048A6
LU WWN Device Id: 5 f8db4c 2311048a6
Firmware Version: CS900LA5
User Capacity: 1,000,204,886,016 bytes [1.00 TB]
@arraytools
arraytools / delta_correlated.R
Last active August 6, 2023 16:58
Variance of log(xbar/ybar) by delta method
# Generate {(x1,y1), ..., (xn,yn)} where x1 is indep of (y2, .., yn) but (x1, y1) are correlated.
# Output var(log(xbar/ybar)) 1. sample variance by 'nsim' simulations, 2) delta method approximation
library(MASS)
# Set the sample size and number of simulations
n <- 100
nsim <- 1000
# Set the population means, standard deviations, and correlation
mu_x <- 5
@arraytools
arraytools / resp.txt
Created September 28, 2023 19:29
respiratory data for running longitudinal data analysis. See the SAS document https://documentation.sas.com/doc/en/pgmsascdc/v_012/statug/statug_gee_examples01.htm.
center id treat sex age baseline visit1 visit2 visit3 visit4
1 1 P M 46 0 0 0 0 0
1 2 P M 28 0 0 0 0 0
1 3 A M 23 1 1 1 1 1
1 4 P M 44 1 1 1 1 0
1 5 P F 13 1 1 1 1 1
1 6 A M 34 0 0 0 0 0
1 7 P M 43 0 1 0 1 1
1 8 A M 28 0 0 0 0 0
1 9 A M 31 1 1 1 1 1
@arraytools
arraytools / flatpak.txt
Last active November 4, 2023 13:33
flatpak installation process
$ flatpak install com.obsproject.Studio.flatpakref
Note that the directories
'/var/lib/flatpak/exports/share'
'/home/brb/.local/share/flatpak/exports/share'
are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
@arraytools
arraytools / Dockerfile
Last active August 5, 2024 19:42
RenvDocker example for Docker + Shiny. See https://appsilon.com/renv-with-docker/ for more details.
# Base R Shiny image
FROM rocker/shiny
# Make a directory in the container
RUN mkdir /home/shiny-app
# Install Renv
RUN R -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"
# Copy Renv files and Shiny app
@arraytools
arraytools / officer-R.Rmd
Last active December 27, 2023 22:39
A demonstration of using the 'officer' R package
---
title: "Officer"
output: html_document
date: "2023-12-26"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(officer)
library(flextable)