Skip to content

Instantly share code, notes, and snippets.

View hym3242's full-sized avatar
💭
still lovin' TIOCSTI

hym3242 hym3242

💭
still lovin' TIOCSTI
View GitHub Profile
@hym3242
hym3242 / SkyLight_private_newloginsession.c
Last active December 7, 2025 01:36
Create and switch WindowServer sessions with SkyLight private functions (no need for Fast User Switching, hooray!!!), compile with `cc xxx.c -g -o xxx -framework Carbon -undefined dynamic_lookup`.
#include <stdio.h>
int SLSCreateLoginSession(int *outSession); //courtesy of NUIKit/CGSInternal
int main(){
int outsession;
int ret = SLSCreateLoginSession(&outsession);
printf("login session created: %d\n",outsession);
return ret;
}
@hym3242
hym3242 / clickScreenshotWindowMarkupButton.m
Last active December 7, 2025 01:34
A objc program that clicks the "markup" button in "com.apple.screencaptureui" application 's "ScreenshotAnnotationWindow" (titled "Screenshot")
// compile with: cc clickScreenshotWindowMarkupButton.m -o clickScreenshotWindowMarkupButton -framework Cocoa
// This program clicks the "markup" button in "com.apple.screencaptureui" application 's "ScreenshotAnnotationWindow" (titled "Screenshot")
// Mostly written by the obviously-dumber-than-first-launched ChatGPT 4 Classic. No rights reserved.
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
// Function to find the PID using bundle identifier
pid_t pidForBundleIdentifier(NSString *bundleIdentifier) {
NSArray *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleIdentifier];
@hym3242
hym3242 / SLsymtest.c
Last active December 7, 2025 01:33
macOS privateframework SkyLight.framework private external function test: flash your screen with a visual bell!
//compile with
//cc SLsymtest.c -o SLsymtest -framework Carbon -undefined dynamic_lookup
// -framework for macho loading commands for SkyLight to be loaded otherwise dyld at runtime will complain and abort
// -undefined dynamic_lookup to prevent linker from complaining it can't find a definition/implementation for symbol
void SLDisplayDefaultVisualBell();
int main(){
SLDisplayDefaultVisualBell(); //via default mach port to WindowServer (after SkyLight bootstraps)
return 0;
@hym3242
hym3242 / SkyLightInternals.c
Created May 20, 2024 09:02
Uses some SkyLight private symbols to print some useful stuff
//cc SLsymtest.c -g -o SLsymtest -framework Carbon -undefined dynamic_lookup
#include <unistd.h>
#include <stdio.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreGraphics/CoreGraphics.h>
#include <ApplicationServices/ApplicationServices.h>
void SLDisplayDefaultVisualBell();
void SLSGetDebugOptions(int* options);
@hym3242
hym3242 / StandardKeyBinding.dict.dump.with.notes.txt
Last active October 24, 2025 14:28
Dump of /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict on macOS Ventura 13.4, plus some notes
$ # plz forgive this dumb method of visualization.
$ cp /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict .
$ plutil -convert xml1 StandardKeyBinding.dict
$ plutil -p StandardKeyBinding.dict | unicode-vis | cat -v | tr '\t' '+'
{
"^C" => "insertNewline:"
"^H" => "deleteBackward:"
"^Y" => "insertBacktab:" //shift+tab
"^[" => "cancelOperation:"
"^?" => "deleteBackward:"
@hym3242
hym3242 / macos_interesting_tools.md
Last active May 8, 2025 15:08
macOS interesting tools

macOS interesting tools

many are discovered by scouring the manpages apropos -s 1/8/? .

  • nettop
  • nscurl
  • (arp)
  • textutil
  • wish, tcl/tk etc.
  • last
@hym3242
hym3242 / get-childitem_recursive_ffmpeg_qsv_scrub_find_errors.ps1
Last active January 9, 2025 07:30
Recusively list medida files, use ffmpeg (with hwaccel qsv) to scrub the files (attempt to decode from start to end) to find errors
#$ErrorView = "Basic"
# Suppresses all errors globally in the script/session
#$ErrorActionPreference = "SilentlyContinue" #causes script to stuck at get-childitem
param(
[string]$rootfolderarg
)
function Sanitize-FileName {
param ([string]$fileName)
@hym3242
hym3242 / IAfavlistgen
Created November 18, 2024 09:44
Generate Internet Archive favlist of identifiers
jq -r '.request.backend_requests | to_entries[] | select(.key | test("^favorites_doc")) | .value.finalized_parameters.doc_ids[]'
@hym3242
hym3242 / macOS.10.15.AppKit.symbols.dump!grep.NSKeyBindingCommands.txt
Last active November 11, 2024 22:11
dump of macOS 10.15 AppKit symbols (grep NSKeyBindingCommands)
0x000000000041e50d ( 0x205) -[NSTextView(NSKeyBindingCommands) insertTab:] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x000000000046d4ee ( 0x22d) -[NSTextView(NSKeyBindingCommands) insertNewline:] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x000000000046e21a ( 0x35a) -[NSTextView(NSKeyBindingCommands) deleteBackward:] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x000000000046e574 ( 0x358) -[NSTextView(NSKeyBindingCommands) _checkInList:listStart:markerRange:emptyItem:atEnd:inBlock:blockStart:forCharacterRange:] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x0000000000471d20 ( 0x9e) -[NSTextView(NSKeyBindingCommands) deleteWordBackward:] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x000000000084cf2c ( 0xe5) -[NSTextView(NSKeyBindingCommands) _verticalDistanceForPageScroll] [FUNC, OBJC, NameNList, MangledNameNList, Merged, NList, FunctionStarts]
0x
@hym3242
hym3242 / sonoma-text-insertion-point-downgrade.jxa.js
Created September 16, 2024 15:48 — forked from stephancasas/sonoma-text-insertion-point-downgrade.jxa.js
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';