Skip to content

Instantly share code, notes, and snippets.

@psanford
psanford / chromium-widevine-overlay.nix
Created January 22, 2024 23:13
Overlay for chromium widevine support with 16k pages (asahi on m{1,2,3} macs)
final: prev:
let
lacrosVersion = "120.0.6098.0";
widevine-installer = prev.stdenv.mkDerivation rec {
name = "widevine-installer";
version = "7a3928fe1342fb07d96f61c2b094e3287588958b";
src = prev.fetchFromGitHub {
owner = "AsahiLinux";
repo = "${name}";
rev = "${version}";
[ 0.613626] macsmc-rtc macsmc-rtc: setting system clock to 2022-12-21T17:37:46 UTC (1671644266)
[ 0.714029] pcie-apple 690000000.pcie: Link up on /soc/pcie@690000000/pci@0,0
[ 0.715169) pcie-apple 690000000.pcie: ECAM at [mem 0x690000000-0x690ffffff] for [bus 08-04]
[ 0.716345] pcie-apple 690000000.pcie: PCI host bridge to bus 0000:00
[ 0.717278] pci_bus 0000:00: root bus resource [bus 00-04]
[ 0.717987] pci_bus 0000:00: root bus resource [mem 0x6a0000000-0x6bfffffff pref]
[ 0.718835] pci_bus 0000:00: root bus resource [mem 0x6c0000000-0x6ffffffff] (bus address [0xc000
[ 0.719927] pci 0000:00:00.0: [106b: 100c] type 01 class 0x060400
[ 0.720738] pci 0000:00:00.0: PME# supported from D8 D3hot D3cold
[ 0.721956] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
@psanford
psanford / notchless.patch
Created November 26, 2022 01:44
use full screen for m2 air framebuffer
diff --git a/src/kboot.c b/src/kboot.c
index 67c5eff..e48343f 100644
--- a/src/kboot.c
+++ b/src/kboot.c
@@ -80,6 +80,7 @@ void get_notchless_fb(u64 *fb_base, u64 *fb_height)
printf("display: Hiding notch, %lux%lu -> %lux%lu (+%lu, 16:%lu)\n", cur_boot_args.video.width,
cur_boot_args.video.height, cur_boot_args.video.width, new_height, offset, hfrac);
+ return;
*fb_base += cur_boot_args.video.stride * offset;
@psanford
psanford / ftl-speed-hack-frida.py
Created August 10, 2022 16:09
Speed hack for FTL using frida
import frida
import sys
import fileinput
session = frida.attach("FTL.amd64")
script = session.create_script("""
var timeNowPtr = Module.enumerateSymbols('FTL.amd64').filter(function (a) { return a.name == 'time_now'; })[0].address;
var timeNow = new NativeFunction(timeNowPtr, 'double', []);
@psanford
psanford / config
Created August 2, 2022 17:36
Asahi NixOS kernel config for m2 macbook air
CONFIG_64BIT=y
CONFIG_6LOWPAN=m
CONFIG_6LOWPAN_GHC_EXT_HDR_DEST=m
CONFIG_6LOWPAN_GHC_EXT_HDR_FRAG=m
CONFIG_6LOWPAN_GHC_EXT_HDR_HOP=m
CONFIG_6LOWPAN_GHC_EXT_HDR_ROUTE=m
CONFIG_6LOWPAN_GHC_ICMPV6=m
CONFIG_6LOWPAN_GHC_UDP=m
CONFIG_6LOWPAN_NHC=m
CONFIG_6LOWPAN_NHC_DEST=m
#### YK2 ####
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDACRPtS/mtmS3n1dT6kkSZHRoc/en8opF6v89Ya/RZo5g7ZRKF92LzWQhj9PhiRNmh7ZxbGdQsEr0yRSYB0nO4SBRiJL9Xc3CaAAFDn0+G98Vby4lY5ed0Ts9FaTzYCwqEk9Q6cbvaryxp5+i93/hkGq5Js+emueUJeYR94fmX9SCkB1QA/FJQKAkCaj6jpPhBEwyFNR/4j/loyRsEqF5PNIlqMR27sCiOl1jolNCmBkN/01eiBCx2OXhZkcw6to7wFlBqhDeGutjNo/3c6gVPXGlXwv8/k5ic0souvm5E8HnJc4scQedWOEZ3BVByvTyxb81SmsV2MUSnyw/EWQ5ftB0SZ1IVPvF3x9nRyxIEYfW8DElPMIY3PWh6ZzrrimgS0pncrYmnhcdiGshPJJrSgMIC82kHW9nhGwqRYW5Jki5HrSNtK0l9bUQIcfOmoReKREkJgklTZonG+cm0F5VoDiW/4buAk5PcyR8gWxuixWOc3D3avUuz7Qd4/3G1TX18n85mjPxGpZctyBJkUTMUPqaYUbt3kcV4bcHtfXbGzr0K2OBoHOgi4rvpLRW5HTQ5Gzo9QTUpk9RkAdKhoBRKwOcra1loPCYShAvUXlhwPitvgGAc1s5uLzxJay3DaIKIbERKSKvObZ0i8G/DvQ+rt7iV+OSZouJjgaHTvD3WdQ== openpgp:0x02DDD0CE
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQINBFpugTEBEADymSnWM9gBTo5+866Rli2AJjQbUNAbBWiYqg4ZvSv8VyOxPzGM
EdChJb9MJ3jMzvKXx4T5u2etydz85/ceOM0Ws3a/Bv6F7vbbMbRHwlQZtwBPbRau
GfGvK1xqvaQog8gWpAqhI0yVw50YGocm/DX9SVGovxGnw+Ds4Yin/tHzsbrqwGtA
8oLWmP/HBhn1iF
@psanford
psanford / build-tpm2-tools-ubuntu-20_04.sh
Last active August 20, 2021 20:43
tpm2-tools ubuntu build 20.04
#!/bin/bash
set -euo pipefail
# This is how I build tpm2-tools from master on ubuntu 20.04. The install instructions in the tpm2-tools repo is out of date:
sudo apt-get update
sudo apt-get -y upgrade
# install build-essential
sudo apt-get install -y build-essential
(defun pms-go-run-test (&optional more-test-args)
"Runs tests for current package"
(interactive)
(when (buffer-file-name)
(save-buffer))
(compile (concat "go test -v -count=1 -mod=mod" more-test-args) 'go-compilation)
(ring-insert pms-previous-test-ring
#!/bin/bash
tmp_name="$(tempfile)"
cp $@ $tmp_name
chmod 600 $tmp_name
echo "sha256:"
ssh-keygen -lv -E sha256 -f "$tmp_name"
echo "md5:"