Skip to content

Instantly share code, notes, and snippets.

@jimbrig
jimbrig / pluck_recursive.R
Created June 28, 2024 22:43 — forked from wch/pluck_recursive.R
From a tree, recursively pluck all elements with a particular name
# @drob's version from https://twitter.com/drob/status/1501747414780239879
pluck_recursive <- function(lst, name) {
if (is.list(lst)) {
if (!is.null(lst[[name]])) {
return(lst[[name]])
}
return(unname(unlist(purrr::map(lst, pluck_recursive, name))))
}
}
@jimbrig
jimbrig / gist:0f5a53b44ae75193eefdcc14df04b3f6
Created June 27, 2024 17:00 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@jimbrig
jimbrig / README.md
Created June 21, 2024 22:36 — forked from jcheng5/README.md
Accepting POST requests from Shiny

Accepting POST requests from Shiny

(This post was motivated by a talk by @jnolis at CascadiaRConf 2021)

Recent versions of Shiny have an undocumented feature for handling POST requests that are not associated with any specific Shiny session. (Note that this functionality is missing our normal level of polish; it's a fairly low-level hook that I needed to make some things possible, but doesn't make anything easy.)

In a nutshell, it works by replacing your traditional ui object with a function(req), and then marking that function with an attribute indicating that it knows how to handle both GET and POST:

library(shiny)
/* --------------------------------
Typography
-------------------------------- */
:root {
--font-primary: sans-serif;
--font-secondary: serif;
@jimbrig
jimbrig / signatureTemplate.tex
Created May 29, 2024 17:45 — forked from tudorcoman/signatureTemplate.tex
LaTex signature template (useful for contracts between companies)
\documentclass[a4paper,twoside,11pt]{article}
\usepackage{delarray}
\usepackage{fancyhdr}
\usepackage[cp1250]{inputenc}
\usepackage[T1]{fontenc}
\pagestyle{fancyplain} \fancyfoot[LE,RO]{\thepage} \cfoot{}
\renewcommand{\headrulewidth}{0pt}
\headheight=14pt
@jimbrig
jimbrig / Extending_Trackdown.md
Created May 29, 2024 17:10 — forked from smithjd/Extending_Trackdown.md
Using the R trackdown package for multiple pages and multiple authors

OVERVIEW

I have found that the trackdown package is incredibly useful for collaboration with non-R users. It's design suggests that the main use case was a group of researchers all working on one paper -- a big .Rmd file. The package documentation has a very clear workflow description.

I've put some wrappers and additional code around the package to make working with a couple dozen Distill pages.

This set of functions is handy for synchronizing more than a dozen .Rmd files by simplifying the following:

# vectors
vector <- c(10,20,30, "hello")
# lists
list <- list(1, "hello", 0.5, list(1,2,3), c(2,3,4))
# data types
# logical
class(FALSE)
# numeric
@jimbrig
jimbrig / cheatsheet.ps1
Created May 3, 2024 23:20 — forked from pcgeek86/cheatsheet.ps1
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@jimbrig
jimbrig / docker-compose.yml
Created April 29, 2024 19:01 — forked from JBGruber/docker-compose.yml
My compose file to run ollama and ollama-webui
version: '3.6'
services:
# ollama and API
ollama:
image: ollama/ollama:latest
container_name: ollama
pull_policy: missing
tty: true
@jimbrig
jimbrig / CorrectRecoveryPartitionSize.ps1
Created April 27, 2024 22:27 — forked from mt7479/CorrectRecoveryPartitionSize.ps1
Resize the recovery partition on Windows 10 Systems to save some space
<#
Correct the default UEFI partition layout created by ConfigMgr to save some disk space.
https://docs.microsoft.com/de-de/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions
## Notes:
* The recovery partition size for Windows 10 1703 needs to be at least 900 MB or the partition will ignored.
* Windows 10 1511 Winre.wim size: 313.009.179 Bytes
* Windows 10 1607 Winre.wim size: 324.995.101 Bytes