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
{ | |
"internal" => 0 | |
"name" => "a14" | |
"system" => { | |
"cpu" => { | |
"aliases" => { | |
"Cycles" => "FIXED_CYCLES" | |
"Instructions" => "FIXED_INSTRUCTIONS" | |
} | |
"architecture" => "arm64" |
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
// Sometimes you have a large file on a small disk and would like to "transform" | |
// it in some way: for example, by decompressing it. However, you might not have | |
// enough space on disk to keep both the the compressed file and the | |
// decompressed results. If the process can be done in a streaming fashion, it | |
// would be nice if the file could be "drained"; that is, the file would be | |
// sequentially deleted as it is consumed. At the start you'd have 100% of the | |
// original file, somewhere in the middle you'd have about half of the original | |
// file and half of your output, and by the end the original file will be gone | |
// and you'll be left with just the results. If you do it this way, you might | |
// be able to do the entire operation without extra space! |
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
// As seen on: | |
// https://federated.saagarjha.com/notice/AaEMQpJBSbxhLyxYzg | |
// https://twitter.com/_saagarjha/status/1707423903969341949 | |
// Compiling: gcc mmap_vs_read.c -O3 -o mmap_vs_read | |
// Usage: ./mmap_vs_read <bigfile> <mmap|read> | |
#include <fcntl.h> | |
#include <stddef.h> | |
#include <stdio.h> |
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
// | |
// LinkPresentation | |
// Copyright © 2015-2020 Apple Inc. All rights reserved. | |
// | |
// FIXME: Twitter equivalents? | |
(function () { | |
var MetadataExtractor = { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
var database; | |
async function foo() { | |
let key = await window.crypto.subtle.generateKey( | |
{ | |
name: "HMAC", |
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
// Usage should be fairly self-explanatory, just paste this in a header and use | |
// CRASH_WITH_MESSAGE("foobar") in your function. | |
// Example backtrace: | |
// Thread 0 Crashed:: Dispatch queue: com.apple.main-thread | |
// 0 ??? 0x1022d8000 CRASHING IN test.c:20 (foobar) + 0 | |
// 1 a.out 0x1022d7f60 main + 24 | |
// 2 dyld 0x195f07e50 start + 2544 | |
#define STRINGIFY(a) #a | |
#define CRASH_FUNCTION_NAME(file, line, message) "CRASHING IN " file ":" STRINGIFY(line) " (" message ")" |
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
// https://gist.github.com/saagarjha/ed701e3369639410b5d5303612964557 | |
#import "swizzler.h" | |
#import <Foundation/Foundation.h> | |
#import <cstddef> | |
#import <cstdlib> | |
#import <dlfcn.h> | |
#import <mach-o/dyld.h> | |
#import <mutex> | |
#import <string> | |
#import <tuple> |
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
for function in filter(lambda f: f.name == "_objc_msgSend", bv.functions): | |
selector = function.lowest_address + 4 | |
selector = list(bv.get_code_refs_from(selector))[0] | |
selector = list(bv.get_data_refs(selector))[0] | |
selector = list(bv.get_data_refs_from(selector))[0] | |
selector = bv.get_data_var_at(selector).value | |
# objc_msgSend itself, probably | |
if not selector: | |
continue | |
selector = selector[:-1].decode() |
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
// clang path_hook.mm -shared -ldl -g -framework Foundation path_hook.o -L/usr/lib/swift | |
#include <cassert> | |
#include <cstdint> | |
#include <dlfcn.h> | |
#include <mach/arm/vm_param.h> | |
#include <mach/kern_return.h> | |
#include <mach/mach_init.h> | |
#include <mach/vm_map.h> | |
#include <mach/vm_prot.h> |
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
// Generated via | |
// grep -r -l CFBundleURLSchemes /Volumes/JupiterB19R570.N121bOS/ | xargs -n1 sh -c '/usr/libexec/PlistBuddy -c "Print" "$0" > /dev/null 2>&1 && echo && echo "$0" && /usr/libexec/PlistBuddy -c "Print :CFBundleURLTypes" "$0"' | |
// -[LSApplicationWorkspace openURL:configuration:completionHandler] is a good way to open these | |
/Volumes/JupiterB19R570.N121bOS/System/Library/CoreServices/Carousel.app/Info.plist | |
Array { | |
Dict { | |
CFBundleURLName = com.apple.carousel | |
CFBundleURLSchemes = Array { |
NewerOlder