Skip to content

Instantly share code, notes, and snippets.

View steipete's full-sized avatar

Peter Steinberger steipete

View GitHub Profile
@steipete
steipete / OSLogStream.swift
Last active December 21, 2024 15:11
Access streaming OSLogStore at runtime with SPI. (FB8519418) https://steipete.com/posts/logging-in-swift/
//
// 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
// TODO: FB8068393 Remove once this properly landed in Big Sur.
// These Strings are missing as of b2 (Linker Error)
extension NSToolbarItem.Identifier {
static let primarySeparator = NSToolbarItem.Identifier(rawValue: "NSToolbarPrimarySidebarTrackingSeparatorItem")
static let supplementarySeparator = NSToolbarItem.Identifier(rawValue: "NSToolbarSupplementarySidebarTrackingSeparatorItem")
}
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x00007fff3cdc3c01 SwiftUI`outlined consume of SwiftUI.GraphicsImage.Contents + 1
frame #1: 0x00007fff3d5ba75c SwiftUI`static SwiftUI.GraphicsImage.== infix(SwiftUI.GraphicsImage, SwiftUI.GraphicsImage) -> Swift.Bool + 412
frame #2: 0x00007fff3cf68b41 SwiftUI`static SwiftUI.Image.Resolved.== infix(SwiftUI.Image.Resolved, SwiftUI.Image.Resolved) -> Swift.Bool + 465
frame #3: 0x00007fff45a81acf AttributeGraph`AGDispatchEquatable + 15
* frame #4: 0x00007fff45a6e114 AttributeGraph`AG::LayoutDescriptor::compare(unsigned char const*, unsigned char const*, unsigned char const*, unsigned long, unsigned int) + 1637
frame #5: 0x00007fff45a7a40e AttributeGraph`AGGraphSetOutputValue + 445
frame #6: 0x00007fff3d17f12e SwiftUI`generic specialization <SwiftUI.Image> of SwiftUI.(EnvironmentReadingChild in _FB65686E4F4C246132C16AE349C5E43C).updateValue() -> () + 1838
frame #7: 0x00007fff3d28edef SwiftUI
import XCTest
public enum TestWaitResult {
case wait, success
}
public enum WaitTimeoutCondition {
case fail, skip
}
@steipete
steipete / firebase-iOS-breakdown
Created June 16, 2020 10:18 — forked from zntfdr/firebase-iOS-breakdown.swift
Firebase iOS Version breakdown
// How to:
// 1. Go in the Firebase Analytics Dashboard
// 2. Filter iOS Platform only
// 3. Scroll down, select `Device` under the "What is your audience like?" widget
// 4. Export the CSV data (top right of the corner, there's a `...` menu with Download CSV option)
// 5. Open the file and select the iOS breakdown raw data
// 6. Replace your data with the sample data in this script
// 7. Run the script in a Xcode Playground
// 8. See the terminal output
@steipete
steipete / gist:06f16ca092866e1d649fd46d45c3cb29
Last active June 7, 2020 15:51
Xcode 11.5 (16139) crash while renaming a file. FB7728364
Process: Xcode [2541]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: Xcode
Version: 11.5 (16139)
Build Info: IDEFrameworks-16139000000000000~62 (11E608c)
App Item ID: 497799835
App External ID: 835814967
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [2541]
Hello,
I'd like to request the following information, in accordance with the information rights in the GDPR, and particularly Article 15. Please address all points in this email in turn.
1. A copy of all my personal data held and/or undergoing processing, in a commonly used electronic form (Article 15(3)). Please note that this might also include any audiovisual material (e.g. voice-recordings or pictures) and is not necessarily limited to the information contained in your customer database and/or the information you make available through the ‘manage my profile’ functionality. For all data that would fall under Article 20 (portability), I would like to recieve this in a commonly-used machine readable format. For data that does not fall under Article 20, such as data inferred about me or opinions about me, I would like this in a commonly-used electronic format.
2. If any data was not collected, observed or inferred from me directly, precise information about the source of that data, including the name and c
@steipete
steipete / gist:357387b28d714da6c1e8f47b6924a571
Created June 2, 2020 20:04
macOS graphics driver is cursed
Process: Screens 4 [66291]
Path: /Applications/Screens 4.app/Contents/MacOS/Screens 4
Identifier: com.edovia.screens4.mac
Version: 4.7.5 (14936)
App Item ID: 1224268771
App External ID: 835721196
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Screens 4 [66291]
User ID: 501
//
// Copyright © 2020 Peter Steinberger. MIT Licensed.
//
import Foundation
/// Text input can crash in Mac Catalyst due to a property not being atomic.
/// We swizzle the `documentState` property of `RTIInputSystemSession` to make it thread safe.
func installMacCatalystAppKitTextCrashFix() {
// RTIInputSystemSession is loaded later, so we will check a few times.
@steipete
steipete / gist:7a125b20cce461bf9a072dfacd805507
Created May 20, 2020 09:13
Twitter app crashing on 10.15.5b4
Process: Twitter [18613]
Path: /Applications/Twitter.app/Contents/MacOS/Twitter
Identifier: Twitter
Version: 8.19 (8.19.1)
App Item ID: 1482454543
App External ID: 835910359
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Twitter [18613]
User ID: 501