This file contains hidden or 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; | |
/// Copy the list of in-use network ports — optionally filtering by the ports' state. | |
/// - Parameters: | |
/// - buffer: The buffer into which the port list will populate | |
/// - state: The port state by which to filter. | |
/// - Returns: Expect `KERN_SUCCESS` if the operation was successful. | |
@discardableResult | |
func sysctl_inet_ports_list_copy(_ buffer: UnsafeMutablePointer<[UInt16]>, _ state: Int32? = nil) -> kern_return_t { | |
var kern_return: kern_return_t; |
This file contains hidden or 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
// | |
// NSColor+HexString.swift | |
// | |
// Created by Stephan Casas on 5/22/24. | |
// | |
import Foundation; | |
import AppKit; | |
extension NSColor { |
This file contains hidden or 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
// | |
// MachVMReadWrite.swift | |
// | |
// Created by Stephan Casas on 4/25/24. | |
// | |
import Foundation; | |
/// Starting at the given address, read the byte values into the given buffer. | |
/// - Parameters: |
This file contains hidden or 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
// | |
// NSViewReader.swift | |
// | |
// Created by Stephan Casas on 4/11/24. | |
// | |
import SwiftUI; | |
import AppKit; | |
import Combine; |
This file contains hidden or 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
// | |
// NSManagedObject+DynamicBindings.swift | |
// | |
// Created by Stephan Casas on 3/31/24. | |
// | |
import SwiftUI; | |
import CoreData; | |
protocol DynamicBindings: NSManagedObject { } |
This file contains hidden or 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
// | |
// DumbHTTPServer.swift | |
// DumbHTTPServer | |
// | |
// Created by Stephan Casas on 3/29/24. | |
// | |
import SwiftUI; | |
import Combine; |
This file contains hidden or 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
// | |
// NSApplication+NSResponderDebug.swift | |
// | |
// Created by Stephan Casas on 3/18/24. | |
// | |
import Cocoa; | |
extension NSApplication { | |
This file contains hidden or 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
// | |
// CGEventSupervisor+Convenience.swift | |
// | |
// @see: https://github.com/stephancasas/CGEventSupervisor | |
// | |
// @note: This is provided as an extension because it is poorly-structured as a result of | |
// backward-compatibility consideration. There are several ways it can be improved. | |
// | |
// Created by Stephan Casas on 3/18/24. | |
// |
This file contains hidden or 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 osascript -l JavaScript | |
ObjC.bindFunction('malloc', ['void*', ['int']]); | |
ObjC.bindFunction('memset', ['void*', ['void*', 'int', 'int']]); | |
ObjC.bindFunction('listen', ['int', ['int', 'int']]); | |
ObjC.bindFunction('socket', ['int', ['int', 'int', 'int']]); | |
ObjC.bindFunction('accept', ['int', ['int', 'void*', 'void*']]); | |
ObjC.bindFunction('bind', ['int', ['int', 'void*', 'int']]); |
This file contains hidden or 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
extension NSView { | |
var debugBorder: NSColor? { | |
set { | |
guard let newValue = newValue else { | |
self.layer?.borderColor = nil; | |
self.layer?.borderWidth = 0; | |
return; | |
} | |