Skip to content

Instantly share code, notes, and snippets.

@stephancasas
stephancasas / NSApplication+NSResponderDebug.swift
Created March 18, 2024 20:35
An extension on NSApplication providing a computed property that describes the current responder chain.
//
// NSApplication+NSResponderDebug.swift
//
// Created by Stephan Casas on 3/18/24.
//
import Cocoa;
extension NSApplication {
sudo /usr/libexec/PlistBuddy -c "Add 'GelatoCore:Enabled' bool false" /Library/Preferences/FeatureFlags/Domain/Messages.plist
sudo /usr/libexec/PlistBuddy -c "Add 'Gelato:Enabled' bool false" /Library/Preferences/FeatureFlags/Domain/Sharing.plist
To restore defaults:
sudo /usr/libexec/PlistBuddy -c "delete 'GelatoCore:Enabled'" /Library/Preferences/FeatureFlags/Domain/Messages.plist
sudo /usr/libexec/PlistBuddy -c "delete 'Gelato:Enabled'" /Library/Preferences/FeatureFlags/Domain/Sharing.plist
Reboot your machine after these changes.
@stephancasas
stephancasas / sonoma-text-insertion-point-downgrade.jxa.js
Created October 7, 2023 02:58
Disable Sonoma Text Insertion Point ("Cursor" / "Caret")
#!/usr/bin/env osascript -l JavaScript
const App = Application.currentApplication();
App.includeStandardAdditions = true;
const kCFPrefsFeatureFlagsDir = '/Library/Preferences/FeatureFlags/Domain';
const kCFPrefsFeatureEnabledKey = 'Enabled';
const kUIKitDomainPrefsTemporaryPath = '/tmp/UIKit.plist';
const kUIKitRedesignedTextCursorKey = 'redesigned_text_cursor';
@saagarjha
saagarjha / library_injector.cpp
Last active November 26, 2025 14:30
Load a library into newly spawned processes (using DYLD_INSERT_LIBRARIES and EndpointSecurity)
// To compile: clang++ -arch x86_64 -arch arm64 -std=c++20 library_injector.cpp -lbsm -lEndpointSecurity -o library_injector,
// then codesign with com.apple.developer.endpoint-security.client and run the
// program as root.
#include <EndpointSecurity/EndpointSecurity.h>
#include <algorithm>
#include <array>
#include <bsm/libbsm.h>
#include <cstddef>
#include <cstdint>