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
func exportVisibleImages() { | |
for (windowIndex, window) in UIApplication.shared.windows.enumerated() { | |
let prefix = "iOS\(ProcessInfo.processInfo.operatingSystemVersion.majorVersion)_window\(windowIndex)_images" | |
exportImages(fromRootView: window, toDirectory: "/path/to/target/directory", prefix: prefix) | |
} | |
} | |
func exportImages(fromRootView rootView: UIView, toDirectory directory: String, prefix: String) { | |
let directoryURL = URL(fileURLWithPath: directory, isDirectory: true) | |
try! FileManager.default.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil) |
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
#!/usr/bin/env python3 | |
import argparse | |
import os | |
import csv | |
usage = '''Use this script to generate configure commands. | |
Expected input csv format: identifier,identifier_suffix(optional),ignored,mac-address-with-dashes,ip4-address | |
First line is ignored. |
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 familyName in UIFont.familyNames.sorted() { | |
var hasPrintedFamilyName = false | |
for fontName in UIFont.fontNames(forFamilyName: familyName).sorted() { | |
let font = UIFont(name: fontName, size: 16.0)! | |
guard font.fontDescriptor.symbolicTraits.contains(.traitMonoSpace) else { continue } | |
if !hasPrintedFamilyName { | |
print(familyName) | |
hasPrintedFamilyName = true | |
} |
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
struct MobileProvision { | |
private let dict: [String: Any]? | |
init() { | |
let mpURL = Bundle.main.bundleURL.appendingPathComponent("embedded.mobileprovision") | |
guard let data = try? Data(contentsOf: mpURL) else { | |
dict = nil | |
return | |
} |
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 UIKit | |
public extension UIApplication { | |
func clearLaunchScreenCache() { | |
do { | |
try FileManager.default.removeItem(atPath: NSHomeDirectory()+"/Library/SplashBoard") | |
} catch { | |
print("Failed to delete launch screen cache: \(error)") | |
} |
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 | |
struct LinearStringConsumer { | |
let str: String | |
private(set) var currentIndex: String.Index | |
var currentOffset: String.IndexDistance { | |
return str.distance(from: str.startIndex, to: currentIndex) | |
} |
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
// | |
// dnsLookup.swift | |
// | |
// Created by Robin Kunde on 5/28/21. | |
// | |
import dnssd | |
import Foundation | |
typealias DNSResultHandler = (String, Int) -> Void |
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
#if DEBUG | |
import Foundation | |
import UIKit | |
class SimPasteboardHelper { | |
static let shared = SimPasteboardHelper() | |
private var handle: FileHandle? | |
private var dispatchSource: DispatchSourceFileSystemObject? |
OlderNewer