Skip to content

Instantly share code, notes, and snippets.

View basperheim's full-sized avatar

Benji Asperheim basperheim

View GitHub Profile
@basperheim
basperheim / README.md
Created August 3, 2026 20:12
minecraft-java-26-nether-lava-rescue-macos

Lava Rescue on TLauncher vs Official Mojang Launcher

The important distinctions are these:

  • Game version matters more than launcher. Java 26.1 moved player files from the old playerdata location to players/data, and level.dat now references the singleplayer UUID instead of containing the old Player tag. The guide should explicitly say it is for Java 26.1+ and should not be followed unchanged for 1.21.x or older worlds. ([Minecraft.net][1])
  • The official macOS default directory is the same: ~/Library/Application Support/minecraft/saves ([Minecraft.net][2])
  • Official-launcher installations may use different installation directories, so readers should locate the actual installation folder rather than blindly assume the default. Mojang’s launcher exposes the relevant folder through the Installations screen. ([Minecraft.net][3])
  • Commands may work on the official launcher. Java Edition supports enabling commands through world options or Open to LAN, so /gamemode creative may b
@basperheim
basperheim / fix-direct-draw-windows-issues.md
Last active June 29, 2026 00:17
Fix Windows 11 compatibility and Direct Draw issues with old GOG games

Running Deadlock II: Shrine Wars on Windows 11 — DrawInit failed, DDrawCompat crashes, and rendering corruption

This documents the troubleshooting process used to get the GOG release of Deadlock II: Shrine Wars running on Windows 11.

The original problem was:

DrawInit failed
@basperheim
basperheim / create_svg_from_map.py
Created June 11, 2026 13:34
Create SVG images from map with black borders
from __future__ import annotations
import argparse
from pathlib import Path
import cv2
import numpy as np
import svgwrite
@basperheim
basperheim / neon-yahtzee.html
Created June 9, 2026 01:18
A complete, dependency-free Yahtzee game built as a single standalone HTML file. Features a responsive metallic-blue neon interface, animated and clickable dice, keyboard controls, sound effects generated with the Web Audio API, full Yahtzee scoring, upper-section bonus tracking, local high-score persistence, and optional educational strategy hi…
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="dark" />
<title>NEON YAHTZEE</title>
<style>
:root {
--bg-0: #020712;
@basperheim
basperheim / fix_m4b_tags.sh
Created May 12, 2026 17:47
Shell helper for retagging M4B audiobooks with FFmpeg. Copies only audio streams, preserves chapters, writes clean title/album/artist/genre/date/comment metadata, and avoids common bin_data/text stream remux failures.
fix_m4b_tags() {
local input_file="$1"
local title="$2"
local album="$3"
local artist="${4:-}"
local genre="${5:-Audiobook}"
local date="${6:-}"
local comment="${7:-}"
if [[ -z "$input_file" || -z "$title" || -z "$album" ]]; then
@basperheim
basperheim / convert_audio.py
Created May 5, 2026 00:14
Convert FLAC and other files to 192k MP3s in current dir using Python and FFmpeg.
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import json
import logging
import shutil
import subprocess
import sys
@basperheim
basperheim / pre_calc_tutor.py
Last active May 12, 2026 16:51
Pre-Calculus Tutoring Python Script
#!/usr/bin/env python3
from __future__ import annotations
import random
import sys
from dataclasses import dataclass
from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
@basperheim
basperheim / math_quiz.py
Created March 19, 2026 16:52
Math Quiz Python Script
#!/usr/bin/env python3
from __future__ import annotations
import random
import sys
from dataclasses import dataclass
from decimal import Decimal, InvalidOperation, ROUND_HALF_UP
@basperheim
basperheim / fix-yarn-corepack-macos-homebrew.md
Created December 22, 2025 20:44
Fixing "packageManager: yarn@4.x" projects when Yarn 1.x is shadowing Corepack (macOS/Homebrew)

Fixing "packageManager: yarn@4.x" projects when Yarn 1.x is shadowing Corepack (macOS/Homebrew)

This is the "Yarn 4 project, but my shell keeps running Yarn 1.22" problem.

You'll see an error like:

This project's package.json defines "packageManager": "yarn@4.9.4". However the current global version of Yarn is 1.22.22. ...the project is meant to be used with Corepack...

What happened

@basperheim
basperheim / macos-homebrew-python-setup.md
Last active December 15, 2025 18:04
macOS + Homebrew + Python venvs (Pinned to 3.12 for Pygame) — A Practical Setup + Gotchas

macOS + Homebrew + Python venvs (Pinned to 3.12 for Pygame) — A Practical Setup + Gotchas

This gist is the "do it once, stop suffering" setup for macOS (Apple Silicon) where:

  • Homebrew's default python3 is too new for your project (ex: Python 3.14 breaks/doesn't have stable wheels for stuff like Pygame yet)
  • macOS still has /usr/bin/python3 (often 3.9.x) and it silently wins when Homebrew isn't configured how you think
  • you want a project-local venv that is always Python 3.12, with pip installs going into the venv (no PEP 668 drama)
  • you also want IDLE/Tkinter to work on 3.12 (optional)

This documents the exact failures I hit and the final working config.