- Copy the contents of the last snippet (lldbinit) from the gist page, and paste into your .lldbinit file. This makes the ksdiff macro known inside lldb.
- Put file ksdiff.py in ~/.lldb/
sudo pip install temp- Restart Xcode debug session
(lldb) ksdiff ;
| static void PSPDFFixiOS12AccessibilityTestCrash(void) { | |
| let accessibilityLoaderClass = NSClassFromString(@"UIAccessibilityInformationLoader"); | |
| let accessibilitySEL = NSSelectorFromString(@"_loadAccessibilityInformationOnMainThread:"); | |
| __block IMP originalIMP = pspdf_swizzleSelectorWithBlock(accessibilityLoaderClass, accessibilitySEL, ^(id _self, BOOL onMainThread) { | |
| @try { | |
| ((void (*)(id, SEL, BOOL))originalIMP)(_self, accessibilitySEL, onMainThread); | |
| } @catch (NSException *exception) { | |
| NSLog(@"Exception received: %@", exception); | |
| if ([exception.name isEqualToString:NSInvalidArgumentException] && [exception.reason containsString:@"_accessibilityLoadAccessibilityInformation"]) { | |
| NSLog(@"Ignoring IOS 12b5 weirdness..."); |
| // | |
| // AppDelegate.swift | |
| // SwiftUITestApp | |
| // | |
| // Created by Matt Gallagher on 4/6/24. | |
| // Copyright © 2019 Matt Gallagher. All rights reserved. | |
| // | |
| import Cocoa | |
| import SwiftUI |
| /** | |
| HACK around FB6940492: Mac Catalyst: Crash when presenting view controllers | |
| 'NSRangeException', reason: 'Cannot remove an observer <UINSSceneViewController 0x600003558790> for the key path "view.window.screen.contentLayoutRect" from <UINSSceneViewController 0x600003558790> because it is not registered as an observer.' | |
| 0 CoreFoundation 0x00007fff3b20f183 __exceptionPreprocess + 250 | |
| 1 libobjc.A.dylib 0x00007fff71719b64 objc_exception_throw + 48 | |
| 2 Foundation 0x00007fff3d8ca2aa -[NSObject(NSKeyValueObserverRegistration) _removeObserver:forProperty:] + 578 | |
| 3 Foundation 0x00007fff3d8ca01b -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:] + 74 | |
| 4 Foundation 0x00007fff3d8e2898 -[NSObject(NSKeyValueObserverRegistration) removeObserver:forKeyPath:context:] + 190 |
| frame { | |
| items: [int] # implicit input | |
| value: int # implicit input | |
| min_index: int | |
| max_index: int | |
| mid_index: int | |
| <- found_index: int # explicit output | |
| } | |
| # sel is selector |
| // Created by Marcin Krzyzanowski | |
| import Foundation | |
| public protocol JSONEncodable: Encodable { } | |
| public extension JSONEncodable { | |
| func toJSON(using encoder: @autoclosure () -> JSONEncoder = JSONEncoder()) throws -> String { | |
| try String(decoding: encoder().encode(self), as: UTF8.self) | |
| } |
Twitter thread: https://twitter.com/theshawwn/status/1456925974919004165
Hacker News thread: https://news.ycombinator.com/item?id=29128998
November 6, 2021
jnp.device_put(1) is deceptively simple to write in JAX. But on a TPU, what actually happens? How does a tensor containing the value 1 actually get onto a TPU?
Turns out, the answer is "C++", and a lot of it.
| // | |
| // FreeSpaceViewController.swift | |
| // Free Space | |
| // | |
| // Created by Kyle Howells on 04/05/2022. | |
| // | |
| import UIKit | |
| class FreeSpaceViewController: UIViewController { |