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 / get-childitem_recursive_ffmpeg_qsv_scrub_find_errors.ps1
Last active September 29, 2024 12:23
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 / 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';
@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 / clickScreenshotWindowMarkupButton.m
Last active May 16, 2024 01:14
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 / macos_interesting_tools.md
Last active May 11, 2024 13:49
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 / SkyLight_private_newloginsession.c
Last active June 14, 2024 08:33
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 / dumpTerminalWindowByPartialName.m
Last active May 10, 2024 19:45
Dump full text content (incl. scrollback) of a window of Terminal.app with partial name of the window title.
// I have set my terminal to set wintitle with escape sequence every time a new window is created so that I can dump window by just tty name.
// I have this command in .profile: wintitle $(basename $(tty))
// where wintitle is:
// $ type wintitle
// wintitle is a function
// wintitle ()
// {
// echo -en "\e]0;$1\x01\e\\"
// }
@hym3242
hym3242 / SLsymtest.c
Last active April 22, 2024 17:26
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 / BetterFormattedDescription.txt
Last active April 9, 2024 08:54
Better formatted description of NARA record "Private Motion Pictures of Adolf Hitler and Eva Braun" https://catalog.archives.gov/id/43461
Reel 1
Part 1, b&w, Eva Braun swims with her parents and others at Hitler's mountain retreat at Berchtesgaden. Hitler and Eva greet guests. Eva swims and performs gymnastics.
Part 2, color, shows Hitler, Eva, and the mountains surrounding the retreat. Eva and others swim, surfboard, and play at nearby lakes. Shows Hitler and others on a terrace overlooking the mountains.
Part 3, b&w, Hitler stands with officers as a guard forms and departs.
Part 4, color, shows Eva picking flowers.
Part 5, b&w, Hitler talks to Himmler and other officers.
Reel 2
Part 1, color, shows a panoramic view from the terrace of Hitler's retreat. Eva greets Goebbels. Hitler talks to Himmler and others.
Part 2, b&w, Hitler greets a group of women and children.
Part 3, color, shows the surrounding mountains. Hitler plays with a dog, children play in the snow, and Eva and others swim and play in the water.
@hym3242
hym3242 / PressSpace.ahk
Created March 31, 2024 20:50
PressSpace.ahk for plane grabbing in Battlefield 1
#Persistent
SetTimer, PressSpaceIfBF1, 7
Return
PressSpaceIfBF1:
IfWinActive, ahk_exe bf1.exe
{
Send, {Space down}
Sleep, 10
Send, {Space up}