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.

@tushroy
tushroy / proxmox-realtek-r8168.md
Last active July 23, 2026 23:40
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 / Multipcap.pl
Last active April 20, 2021 00:47
wireshark / pcap tools
#!/usr/bin/env perl
# multipcap.pl
# License MIT + Any article (blog, site, documentation, etc)
# should link back to this page.
# Link : https://gist.github.com/mdeweerd/4bf3375b2ec56b5492a7a4695e19e92e
use strict;
#use File::PCAP::Reader; # Needed to read the pcap file
#use File::PCAP::Writer; # Needed to write the pcap file
@mdeweerd
mdeweerd / logToPcap.pl
Last active May 27, 2021 22:14
Perl script to convert a regular log file as syslog messages in a pcap file for wireshark
#!/bin/perl
# SCRIPT TO CONVERT TEXT LOG TO PCAP FILE
# READS DATES FROM LOG FILE
# WHEN READING FROM PIPE (UNTESTED) WITHOUT DATES,
# THE CURRENT TIMESTAMP IS USED.
#
# Potential parameters to the script:
# Parameter ending in ".log" is the log input file
# Parameter ending in ".pcap" is the log output file
# Digit from 0 to 7 is the log index.
@Salamandar
Salamandar / kicad_generate_gerber.py
Last active October 18, 2020 20:30
Python script that generates Gerber, Drill map, Position file, and zips everything.
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# Salamandar <felix@piedallu.me> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Félix Piédallu
# ----------------------------------------------------------------------------
import sys
@ktcy
ktcy / silence.js
Created October 24, 2018 10:20
Create WAV file containing only silence
function createSilence(seconds = 1) {
const sampleRate = 8000;
const numChannels = 1;
const bitsPerSample = 8;
const blockAlign = numChannels * bitsPerSample / 8;
const byteRate = sampleRate * blockAlign;
const dataSize = Math.ceil(seconds * sampleRate) * blockAlign;
const chunkSize = 36 + dataSize;
const byteLength = 8 + chunkSize;