Skip to content

Instantly share code, notes, and snippets.

@axxapy
axxapy / t2linux-MacBookPro15_1-hardware.md
Last active October 12, 2026 22:32
Linux on MacBook Pro 15" 2018/2019 (MacBookPro15,1, Apple T2): hardware support table (what works, what needs setup, what does not) with fixes and links

How to run Linux on a MacBook Pro 15" 2018/2019 (MacBookPro15,1, Apple T2): what works and how

Result: with the t2linux kernel and a handful of settings almost everything works on this Mac — display, keyboard, trackpad, Touch Bar, Wi-Fi, Bluetooth, audio, camera, Thunderbolt/USB-C, suspend — and idle power gets close to macOS once the AMD dGPU is powered off properly (≈ 3.4 W on battery with the screen off). What doesn't: external displays while the dGPU is off, Force Touch, the T2 video encoder. Firmware updates still need macOS.

My machine: MacBookPro15,1, i9-8950HK, 32 GB, Radeon Pro 560X, 512 GB, dual boot with macOS 15.7. Arch Linux with linux-t2 7.2.9 (t2linux), systemd-boot, Hyprland — the hardware notes are desktop-independent. State as of 2026-10-12.

🟢 works · 🟡 works with a caveat, needs extra steps, or not tested here · 🔴 does not work

Component Status How to make it work / what does not work
@axxapy
axxapy / t2linux-MacBookPro15_1-dgpu-pc3.md
Last active October 12, 2026 07:44
Linux on T2 MacBook Pro 15,1 (2018/2019): package stuck at PC3 fixed by powering the AMD dGPU off like macOS (ACPI PEG0 GFX0.PWRD handshake before gmux power-off), apple-gmux patch + userspace fallback, idle 5 W -> 3.4 W

How to get a T2 MacBook Pro 15,1 below package C-state PC3 on Linux (idle ≈ 5 W → 3.4 W)

Result: with the AMD dGPU powered off the way macOS does it, the package reaches PC7–PC10 instead of stopping at PC3, and idle power on battery with the screen off drops from 4.6–5.7 W to 3.1–3.9 W. Survives suspend/resume. Tested on a MacBookPro15,1 (Radeon Pro 560X) with linux-t2 7.2.9 and apple_gmux.force_igd=1 (panel on the Intel iGPU).

Quick start A: userspace (no kernel rebuild)

sudo pacman -S acpi_call-dkms            # or your distro's acpi_call module
sudo install -m 755 t2linux-MacBookPro15_1-dgpu-pc3_dgpu-off.sh /usr/local/bin/dgpu-off
sudo install -m 644 t2linux-MacBookPro15_1-dgpu-pc3_dgpu-off.service /etc/systemd/system/dgpu-off.service
@axxapy
axxapy / t2linux-MacBookPro15_1-thunderbolt.md
Last active October 12, 2026 07:44
Linux on T2 MacBook Pro 15,1 (2018/2019): Titan Ridge Thunderbolt runtime PM (RTPC) fixes, "device links to tunneled native ports are missing", "HC died" after resume, USB-C hotplug on powered-down controller, S3 instant wake (for the package-stuck-at-PC3 fix see gist d0d177d3adfef4822910bc9521f89cce)

How to let the Thunderbolt controllers power off on a T2 MacBook Pro 15,1 (Linux, Titan Ridge runtime PM)

Result: both Titan Ridge controllers power off when nothing is plugged in (idle on battery, screen off: 7.4 W → 5.1 W), USB-C devices are still detected when plugged into a sleeping controller, drives survive S3, and the Mac no longer wakes right after lid close. Patches p1–p9 against linux-t2 7.2.9. For the separate package-stuck-at-PC3 problem see https://gist.github.com/axxapy/d0d177d3adfef4822910bc9521f89cce.

On the MacBookPro15,1 the two Titan Ridge Thunderbolt controllers stay powered all the time under Linux (≈ 2–3 W at idle). KaiT2en's experimental RTPC patches let the firmware power them off, but on this machine plain USB-C devices were never detected while the controller was off, an attached drive dropped after ~20 s, and the controllers sometimes never came back ("device inaccessible", "HC died"). Three more patches on top fix that here.

Symptoms this is about

  • Idle drain on batte
@axxapy
axxapy / wsl-network.md
Last active September 1, 2025 03:36
WSL network

In order to make wsl-hosted services accessible from outside of the windows machine, there are two options:

1. Bridge mode

  1. Shutdown WSL: wsl --shutdown
  2. Open Hyper-V Manager as administrator
  3. Select your pc, open Virtual Switch Manager
  4. Create new adapter, call it "WSL-Bridge"
  5. Set to "External network"
  6. open %USERPROFILE%/.wslconfig
@axxapy
axxapy / wsl_docker_ssh.md
Last active January 4, 2024 05:39
ssh into WSL2 ubuntu

Summary

The problem addressed here is the challenge of accessing a WSL (Windows Subsystem for Linux) instance from an external network. By default, WSL instances are not directly accessible from outside the host machine. This guide presents a solution using Docker and SSH proxying to allow SSH access to the WSL instance from an external machine via the host machine's Windows IP address.

Prerequisites

  • Windows 10/11
  • WSL2
  • Docker Desktop with WSL support enabled
  • Ubuntu (or another Linux distribution)

Concept

@axxapy
axxapy / exportIndexedDB.js
Last active February 10, 2022 04:07
export indexedDB as a json
((storeName) => {
let _result = {}
const _req = indexedDB.open(storeName)
_req.onsuccess = async () => {
const db = _req.result
let semaphore = 0
for (num in [...db.objectStoreNames]) {
semaphore++
const tableName = db.objectStoreNames[num]
db.transaction(tableName, 'readonly').objectStore(tableName).getAll().onsuccess = (e) => {
@axxapy
axxapy / steam_autoupdate_disable.sh
Last active January 7, 2022 23:42
Disables steam auto update for all installed games (linux)
#!/bin/bash
# https://www.cyberciti.biz/faq/how-to-use-sed-to-find-and-replace-text-in-files-in-linux-unix-shell/
STEAM_PATH="$HOME/.local/share/Steam"
LIBS=($(cat "$STEAM_PATH/config/libraryfolders.vdf" | grep '"path"' | sed s/\"path\"//g | sed s/\"//g))
for LIB_DIR in ${LIBS[@]}; do
GAMES=($(ls -1 "$LIB_DIR"/steamapps/appmanifest_*.acf))
@axxapy
axxapy / runkit.patch
Created April 25, 2015 07:34
runkit php 5.6 fix
diff --git a/runkit_import.c b/runkit_import.c
index e3bc1f7..d7ab65f 100644
--- a/runkit_import.c
+++ b/runkit_import.c
@@ -217,13 +217,13 @@ static int php_runkit_import_class_consts(zend_class_entry *dce, zend_class_entr
}
}
if (
- Z_TYPE_PP(c) == IS_CONSTANT_ARRAY
+ Z_TYPE_PP(c) == IS_CONSTANT_AST
@axxapy
axxapy / install ntfs-3g on mac
Last active January 1, 2016 00:27
ntfs on mac
original: https://github.com/bfleischer/fuse_wait
oosxfuse: http://sourceforge.net/projects/osxfuse/files/osxfuse-2.7.5/osxfuse-2.7.5.dmg/download
ntfs-3g: http://sourceforge.net/projects/catacombae/files/NTFS-3G%20for%20Mac%20OS%20X/
fuse_wait fix: https://github.com/downloads/bfleischer/fuse_wait/fuse_wait-1.1.pkg
# NTFS-3G for Mac OS X
@axxapy
axxapy / prepare-commit-msg
Last active December 2, 2025 13:46
Git hook which adds ticket number extracted from branch name (like TICKET-123_comment) to every commit message.
#!/bin/bash
#
# This hook adds ticket number from branch name to every commit message
#
BRANCH_NAME=$(git symbolic-ref --short HEAD)
MSG=$(head -n 1 $1)
# Check if commit message starts with "fixup!", if so, do nothing and exit
# https://git-scm.com/docs/git-commit/2.32.0#Documentation/git-commit.txt---fixupamendrewordltcommitgt