Skip to content

Instantly share code, notes, and snippets.

@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 February 20, 2023 14:37
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
@Wowfunhappy
Wowfunhappy / Get Refresh Rate.mm
Created January 16, 2022 19:23
Get Refresh Rate
CGDirectDisplayID displays;
uint32_t matchingDisplayCount = 1;
CGGetDisplaysWithRect([[NSApp mainWindow]frame], 1, &displays, &matchingDisplayCount);
double realRefreshRate = CGDisplayModeGetRefreshRate(CGDisplayCopyDisplayMode(displays));
@Wowfunhappy
Wowfunhappy / .gclient
Last active October 9, 2021 18:53 — forked from blueboxd/.gclient
solutions = [
{ "name" : 'src',
"url" : 'https://github.com/Wowfunhappy/chromium-legacy.git',
"deps_file" : 'DEPS',
"managed" : False,
"custom_deps" : {
},
"custom_vars": {
"checkout_pgo_profiles": True,
},