Skip to content

Instantly share code, notes, and snippets.

View Mx-Iris's full-sized avatar

Mx-Iris Mx-Iris

View GitHub Profile
extension StringProtocol {
/// str[NSRange(location:0, length: 9)]
subscript(_ range: NSRange) -> SubSequence {
guard let stringRange = Range<String.Index>(range, in: self) else {
fatalError("String index is out of range")
}
return self[stringRange]
}
@Kyle-Ye
Kyle-Ye / XcodeLLM.md
Last active January 3, 2025 12:10
Enable XcodeLLM for ChinaSKU Mac on macOS 15 Beta 1

Warning

The following guide need to disable SIP to work.

Please confirm the risk of disabling the SIP by yourself.

Another solution which does not require disabling SIP is currently under investigation.

Step 0

Reboot into Recovery OS + Disable SIP

@gabe565
gabe565 / change-arc-icon.md
Last active February 12, 2025 13:54
Change Arc Browser Icon

Change Arc Browser Icon

arc

A collection of commands that change the Arc Browser icon on macOS.

Commands

Theme Command
Candy Arc defaults write company.thebrowser.Browser currentAppIconName candy
@0xdevalias
0xdevalias / reverse-engineering-macos.md
Last active March 1, 2025 21:50
Some notes, tools, and techniques for reverse engineering macOS binaries
@kconner
kconner / macOS Internals.md
Last active March 1, 2025 19:44
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@vocaeq
vocaeq / inject.c
Last active February 16, 2025 10:14 — forked from knightsc/inject.c
An example of how to inject code to call dlopen and load a dylib into a remote mach task. Tested on 12.5 M1 Pro.
#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <mach/mach.h>
#include <mach/error.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <sys/mman.h>
@MapaX
MapaX / makeXCFamework.sh
Created April 26, 2021 10:45
Shell script to create xcframeworks from MLKit frameworks
#!/bin/zsh
makeXCFramework () {
BASEDIR=$(pwd)
echo "Script location: ${BASEDIR}"
LIBNAME=$(basename $BASEDIR)
echo "lib is: $LIBNAME"
cd Frameworks
@frankschlegel
frankschlegel / Combine+SelfBindings.swift
Last active February 17, 2024 02:14
Convenience extensions for Combine adding memory-save bindings and Cancellable management
import Combine
/// Classes implementing this protocol can be target of convenience Publisher
/// bindings and assignments without causing accidental retain cycles.
/// Those bindings and assignments are also released together with the target.
///
/// For example:
///
/// aPublisher.bind(to: self) { me, object in
struct KeychainItem {
// MARK: Nested Types
enum KeychainError: Error {
case noPassword
case unexpectedPasswordData
case unexpectedItemData
case unhandledError(status: OSStatus)
}
@rjchatfield
rjchatfield / ArrayBuilder.swift
Last active February 20, 2025 12:33
ArrayBuilder - Swift ~~FunctionBuilder~~ ResultBuilder
@resultBuilder
public struct ArrayBuilder<Element> {
public static func buildPartialBlock(first: Element) -> [Element] { [first] }
public static func buildPartialBlock(first: [Element]) -> [Element] { first }
public static func buildPartialBlock(accumulated: [Element], next: Element) -> [Element] { accumulated + [next] }
public static func buildPartialBlock(accumulated: [Element], next: [Element]) -> [Element] { accumulated + next }
// Empty Case
public static func buildBlock() -> [Element] { [] }
// If/Else