Skip to content

Instantly share code, notes, and snippets.

@HighLibrarian
HighLibrarian / MyPowerShellProfile.ps1
Last active April 17, 2025 13:26
DailyPowerShellProfile
<#
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@#-:**************=*@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-%+=%%%%%%%%%%%%%%-#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%##%%%%%%%%%%%%%%%%%%%%%%%:*%%=+%%%%%%%%%%%%%%.#@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%#@%%%%%%%%%%%%%%%%%%@%%*#@%%@+%%%%%%%%%%%%%%%+%@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
<#
.SYNOPSIS
Perform Git submodule update to any commit and/or branch.
.DESCRIPTION
This script performs Git submodules updates to any commit and/or branch.
It allows you to update a submodule to the latest commit, to a specific commit, or to the latest/specific commit of a specific branch.
It will automatically commit the changes to the parent repository, and optionally also push them to the remote repository.
.PARAMETER pathToLocalRepo
@dylanpieper
dylanpieper / batching-benchmark.R
Last active March 8, 2025 21:19
Benchmark for Batching LLMs in R
library(hellmer)
library(tidyllm)
library(ellmer)
library(purrr)
library(tictoc)
library(dplyr)
library(tidyr)
library(ggplot2)
library(patchwork)
library(RColorBrewer)
@smach
smach / app_ollama.R
Last active March 21, 2025 16:25
Sample R Shiny app to run local models with an Ollama server. Coded mostly by various LLMs including Posit's Shiny Assistant
# This is a sample R Shiny app chatbot that runs local models with an Ollama server.
# You also need Ollama installed and a ollama server running, plus at least one local model pulled.
# I hard-coded a few local models,
# If you use this, you'll want to hard code yours (including descriptions, or take those out)
# Coded with lots of LLM help + Posit's Shiny Assistant.
library(shiny)
library(shinychat)
library(bslib)
@smach
smach / favicon_app.R
Last active March 12, 2025 13:46
R Shiny app to turn JPGs and PNGs into .ico favicon files. Written mostly by GPT o3-mini-high with help from Claude and Shiny Assistant (and me)
options(shiny.maxRequestSize = 5 * 1024^2) # Limit uploads to 5 MB
library(shiny)
library(magick)
library(base64enc)
library(bslib)
# Helper function to sanitize file names
safeFileName <- function(filename) {
gsub("[^a-zA-Z0-9_.-]", "_", filename)
@dylanpieper
dylanpieper / survey.R
Last active March 2, 2025 19:14
Example survey with expressions and text piping
survey <- list(
title = "R Package Feedback",
pages = list(
list(
name = "ratings_page",
elements = list(
list(
type = "matrix",
name = "rating",
title = "Please rate the shinysurveyjs 📦:",
@dylanpieper
dylanpieper / roxynorm-prefix.md
Last active March 2, 2025 19:15
Pal prompt for roxygen normalization

Roxygen Normalization

You are a terse assistant designed to help R users write roxygen documentation according to CRAN and tidy style with a consistent format. Respond with only the needed R code, no backticks or newlines around the response. Intersperse newlines within function calls as needed, per tidy style.

As example, given the input:

#' app
#'
#' this makes an app
@SMSAgentSoftware
SMSAgentSoftware / Invoke-AIChat.ps1
Last active March 18, 2025 14:56
PowerShell script to chat interactively with various AI models using their REST APIs. Requires API keys stored in an Azure KeyVault.
function Invoke-AIChat {
<#
.SYNOPSIS
Invokes an AI chat model to generate responses based on user prompts.
.DESCRIPTION
This function provides a unified interface to interact with various AI language model providers including:
- Azure OpenAI Services
- OpenAI API
- Anthropic Claude
@disler
disler / README.md
Last active April 20, 2025 23:33
Use Meta Prompting to rapidly generate results in the GenAI Age

Meta Prompting

In the Generative AI Age your ability to generate prompts is your ability to generate results.

Guide

Claude 3.5 Sonnet and o1 series models are recommended for meta prompting.

Replace {{user-input}} with your own input to generate prompts.

Use mp_*.txt as example user-inputs to see how to generate high quality prompts.

@jakubsob
jakubsob / download_ci_snaps.R
Last active December 21, 2024 19:45
Download test snapshots generated on CI
#' Download the latest snapshot artifacts from the CI and update local snapshots
#'
#' @details
#'
#' This function uses Github API to download the latest snapshot artifacts from the CI and update the local snapshots.
#'
#' In order for the API to work it needs to be authenticated.
#'
#' Run the following command in the terminal to authenticate the API:
#' ```