Skip to content

Instantly share code, notes, and snippets.

Avatar

Seán Labastille flufff42

View GitHub Profile
@flufff42
flufff42 / OSLogStoreTestApp.swift
Last active Jul 28, 2021
Test App for reading the current process OSLogStore — updated for iOS 15 Beta 4
View OSLogStoreTestApp.swift
import SwiftUI
import OSLog
@main
struct LogReaderApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
@flufff42
flufff42 / LogReader.swift
Created Jul 8, 2020
Attempting to read OSLogStore in iOS 14 Beta 2
View LogReader.swift
import OSLog
class LogReader: ObservableObject {
var log: OSLogStore
init?() {
do {
log = try OSLogStore.init(scope: .currentProcessIdentifier)
dump(log)
/*
@flufff42
flufff42 / ClearPermission.swift
Last active Mar 5, 2021
Clear a simulator permission entry by adjusting the TCC database and killing the simulator's tccd
View ClearPermission.swift
import Cocoa
func getBootedSimulatorTCCDBPath() -> String {
let getBundlePath = Process()
let outputPipe = Pipe()
getBundlePath.standardOutput = outputPipe
getBundlePath.executableURL = URL(fileURLWithPath: "/usr/bin/xcrun")
getBundlePath.arguments = ["simctl", "get_app_container", "booted", "sean.systems.SimpleUITest"]
getBundlePath.launch()
getBundlePath.waitUntilExit()
@flufff42
flufff42 / SwiftPlaygroundiPadRuntimeSpelunking.swift
Created Jan 19, 2019
Runtime Spelunking with Swift Playgrounds on iPad: Using Bundle.didLoadNotification to see what goodies a private framework contains
View SwiftPlaygroundiPadRuntimeSpelunking.swift
import ObjectiveC
import PlaygroundSupport
import Foundation
var loadedClasses = [String]()
NotificationCenter.default.addObserver(forName: Bundle.didLoadNotification, object: nil, queue: nil, using: { (n) in
let classes = n.userInfo?[NSLoadedClasses] as! [String]
loadedClasses.append(contentsOf: classes)
loadedClasses.sort()
@flufff42
flufff42 / MPRemoteCommandCenter.swift
Created Jan 10, 2017
MPRemoteCommandCenter logging
View MPRemoteCommandCenter.swift
//: Playground - noun: a place where people can play
import Cocoa
import MediaPlayer
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
if #available(OSX 10.12.2, *) {
let centre = MPRemoteCommandCenter.shared()
View Speedy WWDC Viewer.swift
import AVFoundation
import WebKit
import PlaygroundSupport
let playbackRate = 1.7
let session = "417"
let userScript = WKUserScript(source: "document.querySelector('video').playbackRate = \(playbackRate);", injectionTime: .atDocumentEnd, forMainFrameOnly: true)
@flufff42
flufff42 / EnumConundrum.swift
Created Oct 22, 2015
A curious issue when attempting use an enum case as a dictionary subscript.
View EnumConundrum.swift
//: Enums and Dictionaries: how do they work?
import Foundation
enum Enum {
case A
case B
}
class O: NSObject {}
View decryption.log
Sep 22 18:38:20 Bane-of-TXL pkd[116] <Warning>: assigning plug-in com.pcalc.mobile.watchkitapp.watchkitextension(3.5) to plugin sandbox
Sep 22 18:38:20 Bane-of-TXL pkd[116] <Warning>: enabling pid=100 for plug-in com.pcalc.mobile.watchkitapp.watchkitextension(3.5) 4D89534E-38B4-4DA9-927E-BC916E3036A4 /private/var/mobile/Containers/Bundle/Application/DB2AC5B3-2F01-4DA5-811F-B214DA74CEA0/PCalc WatchKit App.app/PlugIns/PCalc WatchKit Extension.appex
Sep 22 18:38:20 Bane-of-TXL kernel[0] <Notice>: AppleFairplayTextCrypterSession::fairplayOpen() failed, error -42004
Sep 22 18:38:20 Bane-of-TXL com.apple.xpc.launchd[1] (com.pcalc.mobile.watchkitapp.watchkitextension[707]) <Warning>: FairPlay decryption failed on binary.
Sep 22 18:38:20 Bane-of-TXL gizmoappd[100] <Warning>: plugin com.pcalc.mobile.watchkitapp.watchkitextension interrupted
@flufff42
flufff42 / gist:bc92115018a50a62a681
Last active Aug 29, 2015
Open file in Xcode at a given line and give it a hand scrolling to the right position
View gist:bc92115018a50a62a681
xed -l 42 file && osascript << SCRIPT
tell application "Xcode-Beta"
activate
end tell
tell application "System Events"
tell application process "Xcode"
click menu item "Jump to Selection" of menu "Navigate" of menu bar 1
end tell
end tell