Skip to content

Instantly share code, notes, and snippets.

View erikvullings's full-sized avatar

Erik Vullings erikvullings

View GitHub Profile
@erikvullings
erikvullings / README.md
Last active May 5, 2025 09:47
Docker swarm setup on Windows using WSL2

WSL2 Docker Swarm Setup Scripts

This repository contains PowerShell scripts to help configure and run a multi-node Docker Swarm cluster using WSL2 on Windows 11, without relying on Docker Desktop. If you need GPU access in your swarm, please read Tom Lankhort's gist.

These scripts automate:

  • Port forwarding using netsh (TCP and UDP)
  • Generation of config.toml for wsl2proxy
  • Service installation and startup of wsl2proxy
  • Docker Swarm initialization (manager)
@erikvullings
erikvullings / docker-compose.yml
Created May 4, 2025 19:03
Traefik running in docker swarm
services:
traefik: # Your Traefik service name as defined in your compose file
image: traefik:v3.3.6 # Use the specific version
command:
# Enable the API and Dashboard without TLS
- --api.insecure=true
# Listen on the 'web' entrypoint (HTTP) on the new internal port 8091
- --entrypoints.web.address=:8091
# Listen on the 'dashboard' entrypoint on the new internal port 8092
- --entrypoints.dashboard.address=:8092
@erikvullings
erikvullings / README.md
Created December 14, 2024 10:18
Highlight text in a data object

Highlighter

TypeScript highlighter that takes a data object, and applies a highlighting function to selected property values.

I needed to render a data object representing an article. Before rendering it to HTML, I wanted to mark certain parts of the text with a background color.

  1. Create string or regex-based highlighters descriptions
  2. Create a factory function that takes these highlighters and converts them to functions that will wrap matching text with an HTML mark element and background color. It returns a highlighter.
  3. Use the highlighter to convert the original data object to a data object with the same shape, but where matching text is highlighted.
@erikvullings
erikvullings / app.ts
Created November 3, 2024 11:56
Plugin for mithril-ui-form of the SearchSelect component
import { registerPlugin } from 'mithril-ui-form';
import { searchSelectPlugin } from './search-select-plugin';
// Register plugin under the name `search_select` or any other name of your choosing.
registerPlugin('search_select', searchSelectPlugin);