Skip to content

Instantly share code, notes, and snippets.

View KasperSkytte's full-sized avatar

Kasper Skytte Andersen KasperSkytte

View GitHub Profile
@KasperSkytte
KasperSkytte / server.R
Created January 2, 2017 09:12 — forked from trestletech/server.R
A Shiny app combining the use of dplyr and SQLite. The goal is to demonstrate a full-fledged, database-backed user authorization framework in Shiny.
library(shiny)
library(dplyr)
library(lubridate)
# Load libraries and functions needed to create SQLite databases.
library(RSQLite)
library(RSQLite.extfuns)
saveSQLite <- function(data, name){
path <- dplyr:::db_location(filename=paste0(name, ".sqlite"))
@KasperSkytte
KasperSkytte / adjustHydrometer.R
Created July 26, 2019 07:55
Homebrew: R function to adjust hydrometer gravity reading
adjustHydrometer <- function(SG = 1010,
temp = 25,
calibTemp = 20,
unit = "C") {
#initial argument checks
if(!is.numeric(SG))
stop("Argument \"SG\" must be numeric", call. = FALSE)
if(!is.numeric(temp))
stop("Argument \"temp\" must be numeric", call. = FALSE)
if(!is.numeric(calibTemp))
@KasperSkytte
KasperSkytte / adjustGravityTable.R
Created July 26, 2019 08:29
Homebrew: R code to generate a colored table to adjust hydrometer reading for printing (A4). See resulting plot at https://imgur.com/gallery/85Xe1XY
#source adjustHydrometer() function
source("https://gist.githubusercontent.com/KasperSkytte/0b94ae24645d16e97099a201f48bcd8b/raw/0b1676233d0fd380224359badb8584723022d83d/adjustHydrometer.R")
library(ggplot2)
#make a data frame with all combinations of selected ranges of SG and temperature
SG <- seq(1010L, 1110L, 2L)-1000L
tempC = seq(10, 75, 1L)
df <- expand.grid(SG = SG,
tempC = tempC)
df$tempF <- df$tempC*1.8+32
@KasperSkytte
KasperSkytte / ABVtable.R
Created July 26, 2019 08:43
Homebrew: R code to generate a colored table to estimate alcohol by volume (ABV) for printing (A4). See resulting plot at https://imgur.com/gallery/wmd4zzJ
library(ggplot2)
library(purrr)
#make a data frame with all combinations of selected ranges of OG and SG
OG = seq(1030L, 1110L, 2L)
FG = seq(1005L, 1030L, 1L)
df <- expand.grid(OG = OG,
FG = FG)
#calculate ABV with all combinations of OG and SG
df$ABV <- 1.05*(df$OG-df$FG)/(df$FG*0.79)*100
@KasperSkytte
KasperSkytte / phyloseq_to_ampvis2.R
Last active September 12, 2023 10:04
Convert phyloseq object to ampvis2 object
phyloseq_to_ampvis2 <- function(physeq) {
stop("The phyloseq_to_ampvis2 function is deprecated. amp_load() now supports loading a phyloseq object directly.", call. = FALSE)
}
BootStrap: docker
From: nvidia/cuda:11.2.0-cudnn8-devel-ubuntu20.04
%post
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
echo 'export LC_ALL=C.UTF-8' >> $SINGULARITY_ROOTFS/$SINGULARITY_ENVIRONMENT
echo 'export LANG=C.UTF-8' >> $SINGULARITY_ROOTFS/$SINGULARITY_ENVIRONMENT
@KasperSkytte
KasperSkytte / buildandrun.sh
Last active November 26, 2021 14:21
Run RStudio with a specific R version through a docker container with support for renv caching on host.
#!/usr/bin/env bash
set -eu
#set variables
r_ver="${r_ver:-"4.0.4"}"
image_name="${image_name:-"rstudio_r${r_ver}"}"
password="${password:-"supersafepassword"}"
port="${port:-"8787"}" #will generate a random one if unavailable
RENV_PATHS_CACHE_HOST="${HOME}/.local/share/renv/cache" #path to renv cache on host, renv default is ~/.local/share/renv/cache
RENV_PATHS_CACHE_CONTAINER="/usr/local/lib/R/renv-cache/" #path to renv cache within the container (dont have to change)
@KasperSkytte
KasperSkytte / run_playbook.bash
Last active November 29, 2022 13:53
Simple shell script to install Ansible as well as required galaxy roles into a python virtual environment, and then run an ansible-playbook.
#!/usr/bin/env bash
# This script will install Ansible into a virtual environment as well as required
# Ansible Galaxy roles, then execute ansible-playbook from the environment.
#
# Usage:
# bash run_playbook.bash playbook.yml
#
# All arguments/options are passed to the ansible-playbook command.
# Currently only designed for Debian family Linux distributions.
# Made by Kasper Skytte Andersen

Ultimate Beginner's Guide to Proxmox GPU Passthrough

mirror of The Ultimate Beginner's Guide to GPU Passthrough (Proxmox, Windows 10) by /u/cjalas

>Welcome all, to the first installment of my Idiot Friendly tutorial series! I'll be guiding you through the process of configuring GPU Passthrough for your Proxmox Virtual Machine Guests. This guide is aimed at beginners to virtualization, particularly for Proxmox users. It is intended as an overall guide for passing through a GPU (or multiple GPUs) to your Virtual Machine(s). It is not intended as an all-exhaustive how-to guide; however, I will do my best to provide you with all the necessary resources and sources for the passthrough process, from start to finish. If something doesn't work properly, please check /r/Proxmox, /r/Homelab, /r/VFIO, or