Skip to content

Instantly share code, notes, and snippets.

@davidar
davidar / earlyoom-desktop-linux.md
Created February 22, 2026 04:32
earlyoom configuration for desktop Linux — swap-aware OOM prevention with process targeting

earlyoom for Desktop Linux

The default kernel OOM killer reacts too late for desktop use — by the time it fires, the system is deep in swap thrash and unresponsive. systemd-oomd is better but still too conservative for desktops with lots of browser tabs.

earlyoom monitors memory and swap usage and kills processes before the system becomes unusable.

Install

# Fedora / rpm-ostree
@davidar
davidar / nvidia-hybrid-gpu-power-management.md
Created February 22, 2026 04:30
Fix slow Flatpak/app launches on NVIDIA hybrid laptops caused by GPU D3 sleep wake latency

Fix Slow App Launches on NVIDIA Hybrid Laptops (GPU D3 Sleep)

Problem

Apps (especially Flatpaks) take ~2 seconds to launch because the NVIDIA dGPU enters D3 power state when idle. Waking from D3 adds ~2 seconds of latency to any GPU operation.

This affects hybrid laptops (NVIDIA + AMD/Intel iGPU) where the kernel's runtime power management suspends the dGPU.

Solution

@davidar
davidar / dropbox-flatpak-cli-fix.md
Created February 22, 2026 04:28
Fix Dropbox CLI (dropbox.py) not detecting the Flatpak Dropbox daemon

Fix Dropbox CLI with Flatpak Dropbox

Problem

The official Dropbox CLI (dropbox.py) doesn't detect the Flatpak Dropbox daemon. Commands like dropbox status report "Dropbox isn't running" even when it is.

Root cause: The CLI checks ~/.dropbox/dropbox.pid, but the Flatpak daemon writes its sandboxed PID there, which doesn't correspond to a real process on the host.

Fix

@davidar
davidar / goodix-fingerprint-fedora-atomic.md
Created February 22, 2026 04:26
Fix Goodix fingerprint scanner (27c6:550a) on Fedora Atomic (Silverblue, Bluefin, etc.) with PAM timeout fix

Goodix Fingerprint Scanner on Fedora Atomic (Silverblue, Bluefin, etc.)

Tested with Goodix 27c6:550a on Fedora 43 (Bluefin DX, nvidia-open). Should work for other Goodix TOD-compatible readers.

Install the Driver

The Goodix driver requires libfprint-tod, which replaces the base libfprint package.

# Add the COPR repo (uses $releasever automatically)
@davidar
davidar / qt-flatpak-dark-mode-gnome.md
Created February 15, 2026 06:47
Qt Flatpak apps don't detect dark mode on GNOME — root cause analysis and workaround

Qt Flatpak Apps Don't Detect Dark Mode on GNOME

TL;DR: Qt6 Flatpak apps using the KDE runtime ignore GNOME's dark mode preference. The workaround is three environment variables + Kvantum.

The Problem

If you run Qt/KDE Flatpak apps (qBittorrent, OBS Studio, VLC, etc.) on GNOME with dark mode enabled, they render with a light theme — white backgrounds, light widgets, the works.

This is caused by two bugs in the Qt/KDE stack.

@davidar
davidar / enable-webgpu-flatpak-chrome.md
Created December 28, 2025 12:55
Enable WebGPU on Flatpak Chrome (Linux)

Enable WebGPU on Flatpak Chrome (Linux)

WebGPU isn't enabled by default on Linux Chrome. Here's how to enable it for Flatpak Chrome.

Quick Setup

Create the config file at ~/.var/app/com.google.Chrome/config/chrome-flags.conf with these contents:

--enable-unsafe-webgpu
@davidar
davidar / fix-claude-code-flatpak-chrome.md
Created December 28, 2025 12:31
Fix Claude Code Chrome extension with Flatpak Chrome (Fedora Silverblue, etc.)

Fix Claude Code Chrome Extension with Flatpak Chrome

If you're using Chrome installed via Flatpak (common on Fedora Silverblue, immutable distros, etc.), the Claude Code browser automation won't work out of the box. Here's how to fix it.

The Problem

Claude Code installs the native messaging host to the standard Chrome location, but Flatpak Chrome:

  1. Looks for native messaging hosts in a different directory
  2. Has a sandboxed /tmp that isolates the Unix socket used for communication
  3. Doesn't have access to ~/.claude/ or ~/.local/share/claude/ by default
# Base model configuration
base_model: mistralai/Mistral-Small-24B-Base-2501
model_type: MistralForCausalLM
tokenizer_type: AutoTokenizer
trust_remote_code: true
tokenizer_use_fast: true
# Device settings - simpler approach for multi-GPU
# Use balanced loading with 4-bit quantization
device_map: "balanced"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Polykite Tiling Explorer
Author: OpenAI GPT-4
Description:
This script explores the tiling properties of polykites, specifically those with 8 components.
It generates all possible polykites with 8 components, canonicalizes them to avoid duplicate
analysis, and then computes their isohedral numbers to identify interesting candidates for further
mathematical exploration.