Skip to content

Instantly share code, notes, and snippets.

View 573's full-sized avatar

Daniel Kahlenberg 573

View GitHub Profile

Patching the Dynamic Linker/Loader of a Compiled Binary using patchelf

Given a foreign binary on a Nix system, you have to patch its dynamic linker/loader.

First you need to find out what linker/loader to use.

You can do this by going into your nix repl and loading your desired nixpkgs.

Then you run:

@573
573 / Hyper-V GPU-PV with Linux guest.md
Created September 25, 2025 08:39 — forked from krzys-h/Hyper-V GPU-PV with Linux guest.md
Ubuntu 21.04 VM with GPU acceleration under Hyper-V...?

Ubuntu 21.04 VM with GPU acceleration under Hyper-V...?

Modern versions of Windows support GPU paravirtualization in Hyper-V with normal consumer graphics cards. This is used e.g. for graphics acceleration in Windows Sandbox, as well as WSLg. In some cases, it may be useful to create a normal VM with GPU acceleration using this feature, but this is not officially supported. People already figured out how to do it with Windows guests though, so why not do the same with Linux? It should be easy given that WSLg is open source and reasonably well documented, right?

Well... not quite. I managed to get it to run... but not well.

How to do it?

  1. Verify driver support
@573
573 / Cargo.toml
Created August 27, 2025 18:12 — forked from gsquire/Cargo.toml
Export your Pocket CSV to a NETSCAPE bookmark file that linkhut can import
[package]
name = "pocket2linkhut"
version = "0.1.0"
edition = "2024"
[dependencies]
anyhow = "1.0"
argh = "0.1"
csv = "1.3"
serde = { version = "1.0", features = ["derive"] }
@573
573 / .gitignore
Created August 24, 2025 07:58 — forked from wenkokke/.gitignore
Code to print out all voice commands in the knausj talon repository,
cheatsheet.tex
*.aux
*.fls
*.log
*.synctex.gz
*.fdb_latexmk
*.lot

A sensible NixOS Xfce Configuration

NixOS provides good support for the Xfce desktop environment out-of-the-box, but the defaults are minimal. The files in this Gist provide a more complete experience, including a suite of basic software and plugins as well as an optional home-manager configuration for theming.

The key additions to the default Xfce provided by NixOS are:

  • Complete bluetooth / audio support with panel indicators and apps
  • LightDM with theme
  • Extra Xfce apps for calendaring, disk partitioning, etc.
  • Various quality-of-life improving non-essentials
@573
573 / .emacs
Created May 8, 2025 09:48 — forked from amygrinn/.emacs
Autoshare -> Tasker -> Termux -> Org Protocol -> Org Capture
;; Required setup for emacs init file
(package-initialize)
(require 'org)
(require 'org-protocol)
;; Set 'my-org-directory' to the base directory of all of
;; your org files (with a trailing slash). For me it's:
(setq my-org-directory "/scp:org:/home/orgmode/")
;; But it could be a local directory for you
@573
573 / mkenv.sh
Created September 30, 2024 13:00 — forked from yihuang/mkenv.sh
build nix shell from python requirements.txt
# build python nix shell from a local `./requirements.txt`
mkdir ./env
cat > ./env/flake.nix << 'EOF'
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
@573
573 / yubikey+gpupgp+ssh_howto.md
Created September 19, 2024 14:54 — forked from xirkus/yubikey+gpupgp+ssh_howto.md
Security Adventures 1. How to get yubikey+gpg+ssh+gitbhub working on MacOS

I've spent the day trying to get this setup working with GitHub and given the number of gotcha's I encountered, it seemed like a good idea to document how I finally got this working with as few hacks as possible. There's a lot of documentation out there (some of it old and misleading) and committing here for posterity will help me remember this when I inevitably need to do this again.

Rationale

Passwords are simply not enough these days. Regardless of the company, breaches (and the associated Personally Identifiable Information harvested) are a matter of not if, but when. There are a number of things you can do to protect yourself, but being on the tin-foil-hat side of paranoia, means there are a few Commandents that I adhere to (and recommend for other folks)[Insert link to Fight Club Rules for the Secure Internet].

That being said, if you use 2-factor authentication and have committed to using a hardware token such as the Yubikey, then you're already ahead of the curve. The problem is that wh

@573
573 / hetzner_nixos_luks.md
Created June 22, 2024 20:07 — forked from alicebob/hetzner_nixos_luks.md
nixos 24.05 with full disk encryption on Hetzner cloud

Setup full disk encryption on a Hetzner cloud CX42 machine. No fancy SSH unlock: you have to go to their web based terminal to enter the disk password on boot.

Notes:

  • Their web based terminal is /weird/. You can paste things, but it looks like it's set up for a german keyboard, and many characters change ("http://" into "http;//"), sometimes it converts everything to lowercase after a while, sometimes it enters some capslocks mode. I ended up typing as much as possible by hand, and only use alphanumeric passphrases so there are no surprises when copy-pasting those.
  • The (qemu) virtual machine doesn't use EFI, but Legacy Boot. Most setup instructions I found are for EFI systems.

there we go

  • In the Hetzner UI click the server in the list, go to tab [ISO Images], search for "nix", and mount "NixOS 24.05 (x86_64/minimal)"
  • Reboot, and open the terminal. (the's a button on the top with [>_], which is a shortcut for the terminal)