This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example usage: | |
// Swizzler<NSString *, NSDateFormatter *, NSDate *> NSDateFormatter_stringFromDate_ { | |
// NSDateFormatter.class, @selector(stringFromDate:), [&](auto self, auto date) { | |
// if ([NSCalendar.currentCalendar components:NSCalendarUnitWeekday fromDate:date].weekday == 4) { | |
// return @"It Is Wednesday My Dudes"; | |
// } else { | |
// return NSDateFormatter_stringFromDate_(self, date); | |
// } | |
// } | |
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>UnifiedBar</key> | |
<dict> | |
<key>DisclosureRequired</key> | |
<string>ace440ac-b4f6-4b43-aade-02bba1589aef</string> | |
<key>Enabled</key> | |
<false/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import UIKit | |
extension Color { | |
var uiColor: UIColor { | |
if #available(iOS 14, *) { | |
// iOS 14 introduces an API to convert SwiftUI.Color to UIKit.UIColor | |
// but it does not produce a color which reacts to changes in color scheme | |
// (light mode/dark mode). To make that work we need to extract the color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csrutil disable | |
sudo nvram boot-args="intcoproc_unrestricted=1 kext-dev-mode=1 amfi_allow_any_signature=1 amfi_unrestrict_task_for_pid=1 PE_i_can_has_debugger=1 cs_enforcement_disable=1 amfi_get_out_of_my_way=1 amfi=0xff cs_debug=1 ipc_control_port_options=0" | |
sudo spctl --global-disable | |
sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO | |
sudo defaults write /Library/Preferences/com.apple.security.coderequirements Entitlements -string always | |
sudo defaults write /Library/Preferences/com.apple.security.coderequirements AllowUnsafeDynamicLinking -bool YES | |
sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool YES | |
defaults write com.apple.loginwindow DisableScreenLockImmediate -bool yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// OSLogStream.swift | |
// LoggingTest | |
// | |
// Created by Peter Steinberger on 24.08.20. | |
// | |
// Requires importing https://github.com/apple/llvm-project/blob/apple/master/lldb/tools/debugserver/source/MacOSX/DarwinLog/ActivityStreamSPI.h via bridging header | |
import Foundation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addmedia | |
addphoto | |
addvideo | |
appinfo | |
boot | |
bootstatus | |
clone | |
create | |
darwinup | |
delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Setup the environment | |
mkdir tmp_download | |
cd tmp_download | |
#Extract IDs | |
echo "Downloading the index" | |
wget -q https://developer.apple.com/videos/wwdc2019/ -O index.html | |
# find parts of the document where data-released=true, all the way to the first H4 header where title of that talk is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <assert.h> | |
//Compile with `clang -Os -framework Foundation -fno-objc-arc inlinestorage.m -o inline, run with `inline clever` or `inline naive` | |
/* | |
NaiveArray implements a simple immutable NSArray-like interface in probably the most obvious way: store a pointer to a C array of objects | |
*/ | |
@interface NaiveArray : NSObject { | |
NSUInteger count; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)testDispatchConcurrentExecutionWithNamedQueuesRaw { | |
let expectation = [self expectationWithDescription:@"Concurrent execution must happen"]; | |
let semaphore = dispatch_semaphore_create(0); | |
// global queue, concurrent | |
let attributes = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_DEFAULT, 0); | |
let defaultQueue = dispatch_queue_create("com.pspdfkit.default-concurrent", attributes); | |
// serial sub-queues that dispatch to concurrent queue | |
let queue1 = dispatch_queue_create("com.pspdfkit.queue1", DISPATCH_QUEUE_SERIAL); |
NewerOlder