Skip to content

Instantly share code, notes, and snippets.

View lzlrd's full-sized avatar
🛍️
Keeping the digital till running.

Diab Neiroukh lzlrd

🛍️
Keeping the digital till running.
View GitHub Profile
@lzlrd
lzlrd / wslg-guide.md
Last active July 28, 2026 21:06
How to get WSLg working with OpenGL, Vulkan, and CUDA on (Official) Arch Linux and Ubuntu WSL Instances.

WSLg with OpenGL, Vulkan, and CUDA on (Official) Arch Linux and Ubuntu WSL Instances

Note: I haven't documented CUDA here. I'm lazy (and haven't tested on Arch). See https://documentation.ubuntu.com/wsl/en/latest/howto/gpu-cuda for that on Ubuntu.

Context

microsoft/wslg#1312:

So I got this working on both Ubuntu, and Arch. First, start with a fresh install (of archlinux from https://gitlab.archlinux.org/archlinux/archlinux-wsl or Ubuntu from wsl --install Ubuntu or https://apps.microsoft.com/detail/9pdxgncfsczv).

Arch

@lzlrd
lzlrd / disable-cstate
Last active June 7, 2026 10:28
A Systemd Service to disable CPU C-States at runtime. A hack whilst I tune voltages for stability.
#! /usr/bin/env bash
SYSFS_FILES_PATTERN="/sys/devices/system/cpu/cpu*/cpuidle/state[$1]/disable"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root."
exit 1
fi
cleanup() {
#! /usr/bin/env bash
# For OpenWrt hotplug.d Scripts
if [ -n "$ACTION" ]; then
if [ "$ACTION" = "add" ] || [ "$ACTION" = "ifup" ]; then
:
else
exit 0
fi
fi
@lzlrd
lzlrd / 20-makepkg.hook
Last active November 1, 2025 22:18
A Makepkg configuration for Arch Linux that utilises LLVM and takes optimisation up to eleven.
[Trigger]
Operation = Install
Operation = Upgrade
Type = Path
Target = etc/makepkg.conf
Target = usr/share/makepkg/buildenv/lto.sh
Target = usr/share/makepkg/executable/strip.sh
[Action]
Description = Modifying the Makepkg configuration...
@lzlrd
lzlrd / gs2pdf.js
Created October 5, 2025 11:28
Google Slides to PDF
var atag = "punch-viewer-page-wrapper",
btag = "-caption",
ctag = "aria-setsize",
dtag = "aria-posinset",
msvg = document.getElementsByTagName("svg"),
node = document.querySelectorAll('[class$="' + btag + '"]')[0],
view = document.getElementsByClassName(atag)[0],
size = node.getAttribute(ctag),
data = "",
func = () => {
@lzlrd
lzlrd / Export.spg
Created September 8, 2025 14:46
TCP Optimizer Configuration for Windows 11
[netsh]
AutoTuningLevelLocal=4
ScalingHeuristics=2
CongestionProvider=-1
ReceiveSegmentCoalescing=1
ReceiveSideScaling=1
Large Send Offload=1
Checksum Offload=1
EcnCapability=1
Chimney=2
@lzlrd
lzlrd / MSI Utility v4.ps1
Last active September 8, 2025 14:31
Windows Scripts
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Enables Message Signaled Interrupts (MSI) for all applicable PCI devices.
.DESCRIPTION
This script navigates the Windows Registry to locate the interrupt management
settings for all enumerated PCI devices. It then sets the 'MSISupported' DWORD
value to 1 for each device, which enables MSI mode. This can potentially
improve interrupt handling and system performance for certain hardware.
@lzlrd
lzlrd / Dockerfile
Created October 18, 2023 03:00
NGINX Docker built top of rolling release QuicTLS, Zlib-ng, the ZSTD module, Mimalloc, and the OQS Provider.
FROM alpine:latest
ENV LD_PRELOAD=/usr/lib/libmimalloc-secure.so
ENV MIMALLOC_LARGE_OS_PAGES=1
ENV NGINX_VERSION=1.25.2
RUN GPG_KEYS=13C82A63B603576156E30A4EA0EA981B66B0D967 \
&& CONFIG="\
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
@lzlrd
lzlrd / rc.local
Last active September 1, 2025 20:12
OpenWRT
# --- Performance Tuning (Balanced for 512MB RAM) ---
# See https://wiki.archlinux.org/title/Sysctl#Improving_performance
# Increase network queue backlog for handling traffic bursts.
sysctl -w net.core.netdev_max_backlog=8192
# Set more generous network buffer sizes.
# See https://access.redhat.com/sites/default/files/attachments/20150325_network_performance_tuning.pdf
sysctl -w net.core.rmem_default=524288
sysctl -w net.core.wmem_default=524288
; Null Movement Script for AutoHotkey v2
; This script updates the A and D keys so that only one is held down at a time
; This avoids the situation where game engines treat holding both strafe keys as not moving
; Instead, holding both strafe keys will cause you to move in the direction of the last one that was pressed
; The same logic is applied to the W and S keys (only one can be held at a time)
; Cheers to https://www.youtube.com/watch?v=Feny5bs2JCg&t=335s for mentioning this
#SingleInstance force
Persistent true
ListLines False