Skip to content

Instantly share code, notes, and snippets.

View schuhwerk's full-sized avatar

Vitus Schuhwerk schuhwerk

View GitHub Profile
@schuhwerk
schuhwerk / nest-css.js
Last active June 27, 2025 03:20
Convert CSS to nested CSS
/**
* CSS Nesting Tool (mostly "vibe-coded" with claude-sonnet-4)
*
* Install/Usage
* - Install Bun (https://bun.sh/) / You can also use npm/npx
* - bun install css-tree # Install css-tree dependency
* - bun run nest-css.js plain-input.css > nested-output.css
*/
// because css-tree might not have a default export, or is a CommonJS module.
@schuhwerk
schuhwerk / Learn Frequent Searches (Airtable).js
Last active June 24, 2025 22:30
Search to Anki (Airtable Edition)
// ==UserScript==
// @name Search to Anki (Airtable Edition) - Incognito Aware
// @namespace https://violentmonkey.github.io/
// @version 4.72
// @description Automatically detects recurring Google/DuckDuckGo/etc searches and prompts you to save them as flashcards in an Airtable base. Does not track in Incognito/Private mode.
// @author Vitus Schuhwerk (Refactored by AI)
// @homepageURL https://gist.github.com/schuhwerk/fe21d0118d885c7697e1962a9696c3f0
// @updateURL https://gist.github.com/schuhwerk/fe21d0118d885c7697e1962a9696c3f0/raw
// @match https://www.google.com/search*
// @match https://duckduckgo.com/
@schuhwerk
schuhwerk / Learn Frequent Searches (CrowdAnki).js
Last active June 22, 2025 16:14
Userscript - Automatically detects recurring Google/DuckDuckGo/etc searches and prompts you to save them as flashcards in a GitHub-synced CrowdAnki JSON file. Features a settings menu, post-add cooldown, and Ctrl+Enter shortcut.
// ==UserScript==
// @name Search to Anki
// @namespace https://violentmonkey.github.io/
// @version 3.0
// @description Automatically detects recurring Google/DuckDuckGo/etc searches and prompts you to save them as flashcards in a GitHub-synced CrowdAnki JSON file. Features a settings menu, post-add cooldown, and Ctrl+Enter shortcut.
// @author Vitus Schuhwerk
// @homepageURL https://gist.github.com/schuhwerk/c81cdf22813ee121e1603a0d778be091
// @updateURL https://gist.github.com/schuhwerk/c81cdf22813ee121e1603a0d778be091/raw
// @downloadURL https://gist.github.com/schuhwerk/c81cdf22813ee121e1603a0d778be091/raw
// @match https://www.google.com/search*
@schuhwerk
schuhwerk / Docker & Spaces.md
Last active March 21, 2025 19:53
Docker & Spaces

Make sure the path you are cloning this in does not have spaces (like "New Folder")

git clone https://github.com/dol-lab/bedrock-multisite-docker
cd bedrock-multisite-docker
mkdir bedrock
git clone https://github.com/dol-lab/spaces.git bedrock
# checks/installs dependencies
bash ./docker/scripts/install.sh
@schuhwerk
schuhwerk / md-opener.bat
Last active December 28, 2024 17:53
Open with Obsidian. Choose Proper Markdown-Editor based on file-location (Windows)
:: Universal markdown (.md) file opener with Obsidian vault support
::
:: This script handles two scenarios:
:: 1. Files in Obsidian vault: Opens using obsidian://open?path protocol
:: 2. Files outside vault: Opens using alternative editor (e.g. Typora)
::
:: Setup:
:: 1. Set VAULT_PATH to your Obsidian vault location
:: 2. Set ALT_EDITOR to your preferred markdown editor
:: 3. Register as default .md handler:
@schuhwerk
schuhwerk / logwatch.sh
Last active December 2, 2024 18:22
Log file monitoring and error reporting (via email) script.
#!/bin/bash
# Log file monitoring and error reporting (via email) script.
#
# This script monitors log files for specified error patterns and sends email alerts.
# Features:
# - Configurable file search patterns using find
# - Regex-based error detection
# - Context lines around errors
# - Consolidated email reports
# - Support for custom configuration files
@schuhwerk
schuhwerk / Control Video Speed.js
Last active March 30, 2025 11:16
UserScript. Control Video Playback Speed with Keyboard.
// ==UserScript==
// @name Video Speed Control with Keyboard
// @description Decrease and increase HTML video playback speed with "," and ".". Remembers and applies speeds across page-loads.
// @version 2025-03-30
// @author Vitus Schuhwerk
// @license MIT
// @homepageURL https://gist.githubusercontent.com/schuhwerk/67fb4da50652681b857002e1ba2bf071
// @updateURL https://gist.githubusercontent.com/schuhwerk/67fb4da50652681b857002e1ba2bf071/raw
// @downloadURL https://gist.githubusercontent.com/schuhwerk/67fb4da50652681b857002e1ba2bf071/raw
// @grant GM_getValue
@schuhwerk
schuhwerk / Autolink React.js
Last active June 20, 2024 13:36
Create React App - Link Error Overlay to VS Code
@schuhwerk
schuhwerk / typescript.ts
Created May 14, 2024 10:58
Typescript Hints
// use the strings in an array as types.
const animals = ["cat", "dog", "mouse"] as const
type Animal = (typeof animals)[number] // transformer like "cat" | "dog" | ...
let myAnimal : Animal = "cat" // <- autocomplete works here
// merge two types.
type Prefix = "sub_"
type Numbers = 0 | 1 | 2 | 3 | 4 | 5
type SubNumbers = `${Prefix}${Numbers}` // transforms to sub_1 | sub_2 | ...
let myNumber : SubNumbers = "sub_0" // <- autocomplete works here
@schuhwerk
schuhwerk / Typescript Simple Logger.ts
Last active November 20, 2024 18:03
Simple Logger.ts
const stringToBool = (s: string) => (s.toString().match(/^(true|[1-9][0-9]*|[0-9]*[1-9]+|yes)$/i) ? true : false)
type levelNames = "emerg" | "alert" | "crit" | "error" | "warn" | "notice" | "info" | "debug"
type logLevel = {
name: levelNames
cb: CallableFunction
defaultEnabled: boolean
}
type callableNames = {
[K in levelNames]: CallableFunction