Skip to content

Instantly share code, notes, and snippets.

View mikepulaski's full-sized avatar
👻
Boo!

Mikey mikepulaski

👻
Boo!
View GitHub Profile
@zhuowei
zhuowei / safariinject.m
Last active January 2, 2026 10:19
Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// Restores old tab bar in Safari 15.0 (16612.1.29.41.4, 16612)
// clang -fmodules -shared -Wall -Os -o libsafariinject.dylib safariinject.m
//
// If SIP off:
// DYLD_INSERT_LIBRARIES=$PWD/libsafariinject.dylib /Applications/Safari.app/Contents/MacOS/Safari
//
// If SIP on, you can demo this by manually removing Safari's code signing signature, but many
// features (eg saved logins) won't be readable by the resigned app:
// cp -a /Applications/Safari.app ./
// codesign --remove Safari.app/Contents/MacOS/Safari
// Given an imported C function, that uses a context pointer and a C callback function:
//
// func for_each(_ x: X, context: UnsafeMutableRawPointer!, callback: @convention(c) (UnsafeMutableRawPointer?, Element) -> Void)
//
// When is it safe to use this pattern?
// Example with two captured variables.
typealias Context = (Type1, Type2)
var context = (capture1, capture2)
for_each(x, context: &context) { context, element in