Skip to content

Instantly share code, notes, and snippets.

View alekrutkowski's full-sized avatar

Alek Rutkowski alekrutkowski

View GitHub Profile
@alekrutkowski
alekrutkowski / clipboard_to_qr.ps1
Created August 24, 2026 11:42
Windows clipboard contents ➜ QR code (SVG)
# clipboard-qr-v5.ps1
#
# Self-contained clipboard-to-QR utility for PowerShell 7 on Windows.
# No modules, package repositories, proxy access, or network connection needed.
#
# The QR encoder is implemented directly in this script and writes an SVG file.
# It uses QR Code Model 2, byte mode with UTF-8 ECI, error-correction level L,
# and mask pattern 0.
# Made by GPT-5.6 Extra High

Visualising a function

f <- function(x, y) {
  r <- sqrt(x^2 + y^2)
  ifelse(r == 0, 10, 10*sin(r) / r)
}

stl_md_surface <- functionToSTL(
 f,
@alekrutkowski
alekrutkowski / build_windows_binary.R
Created June 23, 2026 07:59
R function to compile a tar.gz source R package into a zip compiled/binary R windows package
build_windows_binary <- function(src_tar_gz,
out_dir = dirname(normalizePath(src_tar_gz, winslash = "/", mustWork = TRUE)),
lib = file.path(tempdir(), "r-win-bin-lib"),
install_deps = FALSE,
dep_fields = c("Depends", "Imports", "LinkingTo"),
repos = {
r <- getOption("repos")
if (is.null(r) || identical(unname(r["CRAN"]), "@CRAN@")) {
c(CRAN = "https://cloud.r-project.org")
} else {
@alekrutkowski
alekrutkowski / Show-SelectizeDialog.ps1
Last active June 11, 2026 18:17
Show-SelectizeDialog PowerShell Function – inspired by selectize.js
# For usage instructions scroll down
function Show-SelectizeDialog {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[AllowEmptyCollection()]
[object[]] $Items,
[string] $DisplayProperty,
@alekrutkowski
alekrutkowski / lambdas.md
Last active April 14, 2026 08:21
Useful Excel lambda functions

See also https://github.com/alekrutkowski/ExcelLambdaTools


Convert 1-column range monthly dates in the format yyyy-mm, e.g. 2023-11, to 2-column range:

  • 1st column: year number if it's January, otherwise empty
  • 2nd column: the 3-character month code, e.g. "Nov"
=LAMBDA(rng,
 LET(
@alekrutkowski
alekrutkowski / R_logo.txt
Last active January 16, 2026 10:14
R language logo (https://www.r-project.org/logo/) as ASCII art
###############
#####################################
##################################################
########################################################
############################ ###############
##################### ##########
################### #######
################# ################################### ######
################# ###################################### #####
############### ####################################### #####
@alekrutkowski
alekrutkowski / _README.md
Last active November 7, 2025 10:50
Chrome/Edge addon/extension to translate the current web page to a pre-set language when the addon's icon is clicked
@alekrutkowski
alekrutkowski / app.R
Created November 6, 2025 15:05
R/Shiny app similar to Google Translate whole page translation (when you paste a URL)
#### Prerequisites -- in Linux terminal:
# Once:
# pipx install libretranslate
# Run in the background:
# libretranslate
#### Test:
# Open the following page in a web browser
# (but first modify your.shiny-server.domain and your_translate_app_name):
# https://your.shiny-server.domain/your_translate_app_name/?url=https://example.com/&from=en&to=fr
@alekrutkowski
alekrutkowski / app.R
Created November 3, 2025 09:38
R/Shiny app as a simple GET request handler
# Save it as /srv/shiny-server/your_app_name/app.R
library(shiny)
ui <- function(request) {
query <- parseQueryString(request$QUERY_STRING)
txt <- query$txt
a <- as.numeric(query$a)
b <- as.numeric(query$b)