Skip to content

Instantly share code, notes, and snippets.

@Wowfunhappy
Wowfunhappy / main.m
Last active October 31, 2024 01:34
Firefox Key Equivalent Fixer
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import "ZKSwizzle.h"
@interface myNSApplication : NSApplication
@end
@Wowfunhappy
Wowfunhappy / gist:ab459b4bf7c070f31300894c42c427a4
Last active May 27, 2024 16:26
Build Ship of Harkinian for Mac OS X 10.9
Last used with this commit: https://github.com/HarbourMasters/Shipwright/commit/ad0e17383e72c652541e6a90367ab720c6a18723
1. sudo port install libsdl2 libpng glew ninja cmake libzip nlohmann-json boost legacy-support clang-17 macports-libcxx tinyxml2
2. git clone --recursive https://github.com/HarbourMasters/Shipwright.git
@Wowfunhappy
Wowfunhappy / Part 1.py
Created January 23, 2024 22:47
Advent of Code 2022 Day 3
input = open("input.txt")
rucksacks = input.readlines()
commonItems = []
def findCommonItem(compartmentA, compartmentB):
for i in range(0, len(compartmentA)):
for j in range(0, len(compartmentB)):
if (compartmentA[i] == compartmentB[j]):
return compartmentA[i]
import itertools
import random
import time
import re
MAX_EXPONENT = 5
solutionList = []
#Based on https://theconfused.me/blog/solving-the-24-game/
def solve(numbers, expr=[]):
@Wowfunhappy
Wowfunhappy / Info.plist
Last active September 8, 2024 19:50
KQueueScanContinuePatch
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>wowfunhappy.$(PRODUCT_NAME:rfc1034identifier)</string>
@Wowfunhappy
Wowfunhappy / noCFRelease.m
Created April 21, 2022 18:02
Why deal with use-after-free crashes when you can just leak memory instead?
//COMPILE: clang -framework Foundation noCFRelease.m -undefined dynamic_lookup -dynamiclib -o noCFRelease.dylib
//USE: DYLD_INSERT_LIBRARIES=/path/to/noCFRelease.dylib /path/to/foo.app/Contents/MacOS/foo
#include <CoreFoundation/CoreFoundation.h>
#define DYLD_INTERPOSE(_replacement,_replacee) \
__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
Install patched qt 5.9: https://github.com/Wowfunhappy/qt5.9-base-mavericks
sudo port install clang-13 cmake meson ninja graphviz git realpath
git clone --recurse-submodules https://github.com/rizinorg/cutter
mkdir build-cutter && cd build-cutter
cmake \
-DCMAKE_PREFIX_PATH=/usr/local/Qt-5.9.9/ \
#!/bin/sh
test -e /Library/LaunchAgents/com.lookingglassfactory.holoplayservice.plist || echo "Please attempt to install the HoloPlay Service service. Once the installation fails, re-run this script." && exit 1
sudo defaults write /Library/LaunchAgents/com.lookingglassfactory.holoplayservice EnvironmentVariables -dict DYLD_INSERT_LIBRARIES /Library/Application\ Support/Looking\ Glass\ Factory/HoloPlayService/HoloPlayServiceMavericksWorkarounds.dylib
sudo chown root:wheel /Library/LaunchAgents/com.lookingglassfactory.holoplayservice.plist
sudo chmod 644 /Library/LaunchAgents/com.lookingglassfactory.holoplayservice.plist
uudecode "$0" | gzip -d > /Library/Application\ Support/Looking\ Glass\ Factory/HoloPlayService/HoloPlayServiceMavericksWorkarounds.dylib
launchctl load /Library/LaunchAgents/com.lookingglassfactory.holoplayservice.plist
launchctl start com.lookingglassfactory.holoplayservice
exit 0
@Wowfunhappy
Wowfunhappy / ipc_mqueue
Last active March 5, 2022 01:31
Modified version of kern_event.c to stop XNU 2422.115.4 to panic when running Chromium Legacy. See: https://github.com/blueboxd/chromium-legacy/issues/44
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
@Wowfunhappy
Wowfunhappy / gist:2fca7ed5d1b1310de3854b92c65eef7e
Created January 22, 2022 13:24
Building XNU for OS X 10.9.5.
# Install Xcode 5.0.2. Later versions will not work.
git clone https://github.com/apple-oss-distributions/xnu.git
cd xnu/
git checkout d2a0abf2ede8152c5a107fe51e032c1193d2015b
cd ..
git clone 'https://github.com/apple-oss-distributions/dtrace.git'
cd dtrace/
git checkout cdf0eec474eafb19dbb2c998320aaad28f755d0b