Skip to content

Instantly share code, notes, and snippets.

View mdeweerd's full-sized avatar

MDW mdeweerd

  • France
View GitHub Profile
@mdeweerd
mdeweerd / !README.md
Last active September 21, 2026 17:00
WSL2 Port Forwarding to Windows localhost - Persistent rules for LmStudio, MySQL, etc. Tags: wsl2, port-forwarding, powershell, windows, lmstudio, firewall, netsh, localhost, networking, docker-alternative

AllowLmStudio.ps1 - WSL2 Port Forwarding Setup

Overview

This PowerShell script configures firewall and port forwarding rules to allow WSL2 to access services running on the Windows host's 127.0.0.1 (localhost), such as LmStudio, MySQL, or other services.

Problem: By default, WSL2 cannot access services bound to 127.0.0.1 on the Windows host. This script creates the necessary port forwarding rules to enable this access.

Important: The port forwarding rules created by netsh interface portproxy are not persistent across Windows restarts. This script provides solutions to make them permanent.

@mdeweerd
mdeweerd / README.md
Last active April 25, 2025 14:29 — forked from eriknomitch/README.md
aider-commit: Automatic git commit messages with aider

aider-commit

A simple wrapper for using aider to create commits with automatically generated messages using AI. Includes a few extra checks and outputs.

Installation

  1. Set up aider
  2. Add the function to your ~/.zshrc or ~/.bashrc.

Usage

@mdeweerd
mdeweerd / proxmox-realtek-r8168.md
Last active March 3, 2025 00:06 — forked from tushroy/proxmox-realtek-r8168.md
Realtek r8168 Driver for Proxmox VE Kernel version 6.8

Realtek r8168 Driver for Proxmox VE Kernel version 6.8

Blacklist r8169 kernel driver for being loaded

echo blacklist r8169 >> /etc/modprobe.d/blacklist-r8169.conf

Once all of this is completed we are going to update our GRUB to have some specific kernel parameters for our realtek driver

@mdeweerd
mdeweerd / sel_screen.bash
Last active January 28, 2025 00:02
Interactively select a GNU Screen session
#!/bin/bash
#
# Shell function to list the screen sessions on a machine
# and let the user select one from the list using up-down
# arrows.
#
# Add this to your `.bashrc` file or to your `.bashrc.d` directory
# where you should make it executable to be automatically
# sourced in some default `.bashrc` scripts.
@mdeweerd
mdeweerd / bathroom-humidity-exhaust-fan.yaml
Last active December 27, 2024 22:31 — forked from Blackshome/bathroom-humidity-exhaust-fan.yaml
bathroom-humidity-exhaust-fan.yaml
blueprint:
name: Bathroom Humidity Exhaust Fan
description: |
# 🚿 Bathroom Humidity Exhaust Fan
**Version: 2.6**
Step into the future of freshness - customize it your way and experience the convenience of automated humidity control! 🌿🚿
@mdeweerd
mdeweerd / build.bat
Last active March 3, 2025 15:20 — forked from GaryLee/build.bat
Build STM32CubeIDE project from command line.
@ECHO OFF
setlocal enabledelayedexpansion
set "STM32CUBEIDE="
for /d /r "C:\ST" %%d in ("STM32CubeIDE_*") do (
if not defined STM32CUBEIDE (
set "STM32CUBEIDE=%%~fd"
) else (
for /f "tokens=2 delims=_." %%a in ("%%~nd") do (
for /f "tokens=2 delims=_." %%b in ("!STM32CUBEIDE:_= !") do (
@mdeweerd
mdeweerd / addCodespellIgnores.sh
Last active January 22, 2024 10:45
Script to add ignored lines to codespell configuration
#!/bin/bash
#
# Script to add codespell exceptions to the ignores lines file.
#
# The file is named '...-lines-ignore' to make TAB expansion on the cli easier.
#
# The line in the ignore file must match the line in the source
# exactly.
#
# To clean up or create the ignored lines file, just do
@mdeweerd
mdeweerd / !README.md
Last active July 5, 2026 12:55
Monitor OPNsense internet connection

Monitor OPNsense internet connection

OPNsense sometimes "loses" the WAN facing connection when that is "reinitialised" (modem reboot/WAN restart).

Monitoring the WAN facing connection and taking corrective action is the solution proposed by this script.

opnsense_ping_check.sh will ping IP addresses to determine if the WAN connection is still working, and try to restore the WAN if needed by

@mdeweerd
mdeweerd / fix-links.lua
Last active September 24, 2023 20:49 — forked from MyriaCore/fix-links.lua
How to use pandoc with gitlab markdown
@mdeweerd
mdeweerd / !README.md
Last active August 22, 2023 17:18
Scripts for Docker (on Windows)

Scripts

  • optimizeDocker.ps1: Powershell Script to optimize Docker Data File. Gets location from configuration file.
  • moveDocker.cmd: Script to move Docker Data File (out of default directory). Use as moveDockerData.cmd D:\DockerData. Permissions of the target directory should be set to allow access to the wsl process.

Note: The shebang is for cygwin.