Skip to content

Instantly share code, notes, and snippets.

@MrPandir
MrPandir / measure.nu
Created April 15, 2025 13:50
Nushell performance measurement utility
# Measures the average execution time of a specified function over a given number of iterations
export def main [
func: closure # The function (closure) to be executed
iterations: int = 10000 # Number of iterations to run the function
] {
let start_time = date now
1..($iterations) | each { |_| do $func } | ignore
let end_time = date now
@MrPandir
MrPandir / load_dotenv.py
Last active April 24, 2025 10:26
Lightweight Python .env file reader and environment variable loader
from os import environ
from pathlib import Path
__all__ = ["load_env_to_environ"]
def _format(key_or_value: str) -> str:
return key_or_value.strip(" \"'")
@MrPandir
MrPandir / chat-to-input.js
Last active June 2, 2025 16:12
Inserts single words from Twitch chat into specified websites
// ==UserScript==
// @name Twitch Chat Answer Inserter
// @namespace http://tampermonkey.net/
// @author MrPandir
// @version 1.8.2
// @description Inserts single words from Twitch chat into specified websites
// @match https://slovo.win/*
@MrPandir
MrPandir / carapace.nu
Last active March 30, 2025 16:46
My rewritten carapace configuration file for nushell.
use std "path add"
def cache [] {
let func = $in
let version = version | get version
let path = $nu.temp-path | path join "carapace-cache" $version
try {
open $path