Skip to content

Instantly share code, notes, and snippets.

View lzehrung's full-sized avatar

Luke Zehrung lzehrung

  • ClearGov Inc.
  • South Bend, IN
  • 02:47 (UTC -04:00)
View GitHub Profile
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@lzehrung
lzehrung / remove-node_modules-recurse.ps1
Created May 10, 2024 17:44
powershell remove node_modules recursively
Get-ChildItem -Path "." -Include "node_modules" -Recurse -Directory | Remove-Item -Recurse -Force
@bettysteger
bettysteger / Editorjs.vue
Last active December 9, 2025 05:29
Vue 3 SFC for Editor.js using v-model with own custom vue component
<template>
<div class="editorjs" ref="htmlelement"></div>
</template>
<script setup>
import EditorJS from '@editorjs/editorjs';
import EmbedTool from '@editorjs/embed';
import ListTool from '@editorjs/list';
import ImageTool from '@editorjs/image';
import VideoTool from './editorjs/video.js';
import { onMounted, onUnmounted, ref, watch } from 'vue';
@4wk-
4wk- / README.md
Last active February 23, 2026 14:39
Clean uninstall then reinstall of WSL on Windows 10, with systemD support

Uninstall then reinstall WSL on Windows 10 (clean way)

Background

I've been using wsl (version 2) with genie mod for years without issue, but one day, Windows 10 finally catch up on wsl Windows 11 features and gives us a way to use systemD natively.

I wanted to use the new "right way" to enable systemD on Windows Subsystem for Linux (without genie), and I also had a (probably related) infinite Windows RemoteApp error poping in.

Fixing it

A - Uninstall wsl and related stuff

  1. In powershell (as admin)
@lzehrung
lzehrung / win-foreign-addr.ps1
Created May 6, 2022 20:58
open connections
netstat -p TCP -fan | Select -Skip 4 | ForEach {
$Properties = $_.Trim() -split '[\s]+'
[PSCustomObject]@{
'Proto'= $Properties[0]
'Local Address'= $Properties[1]
'Foreign Address'= $Properties[2]
'State'= $Properties[3]
}
} | Select -Expand 'Foreign Address'
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@lzehrung
lzehrung / find-remove-files.ps1
Last active December 10, 2022 07:41
Find all child files modified in the last day and remove them (ignoring errors and confirm prompts)
Get-ChildItem -Recurse -Filter *.csv | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-1)} | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
// inspired by https://schneidenbach.gitbooks.io/typescript-cookbook/content/nameof-operator.html
/** Ensure the string value is a valid property name of type `T` */
function propName<T>(name: keyof T): string {
return name.toString();
}
/** Ensure the string value is a valid property name of instance of type `T`. */
function propOf<T>(instance: T, name: keyof T): string {
return propName<T>(name);
@lzehrung
lzehrung / get-process-using-port.md
Last active August 28, 2024 15:57
Get Process Using Port

Windows:

netstat -aon | findstr '8080'

powershell Get-Process -Id (Get-NetTCPConnection -LocalPort 8080).OwningProcess

{
"application/vnd.lotus-1-2-3": [".123"],
"text/vnd.in3d.3dml": [".3dml"],
"video/3gpp2": [".3g2"],
"video/3gpp": [".3gp"],
"application/octet-stream": [
".a",
".bin",
".bpk",
".deploy",