Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
// Compile this with -rdynamic and your emulator .so with -fPIC -fpie -shared
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "dcheck.h"
static char logfile_name[] = "/tmp/gbtracer.log.XXXXXX";
static int logfile_fd = 0;
@EthanArbuckle
EthanArbuckle / main.m
Created October 28, 2024 01:27
objc object search
#import <objc/runtime.h>
#import <mach/mach.h>
#import <malloc/malloc.h>
#import <dlfcn.h>
typedef struct {
Class targetClass;
void (^block)(id object, BOOL isSubclass, BOOL *stop);
dispatch_semaphore_t semaphore;
BOOL shouldStop;
@platomav
platomav / ealf.py
Created October 12, 2024 11:25
Apple eficheck EALF parser
#!/usr/bin/env python3
# coding=utf-8
"""
Apple eficheck EALF parser
Copyright (C) 2024 Plato Mavropoulos
"""
import ctypes
@niw
niw / update_install_names.rb
Created October 11, 2024 13:57
Make frameworks portable.
#!/usr/bin/env ruby
require 'optparse'
require 'pathname'
def update_name(name, options)
pattern = /#{options[:rpath]}/
if name =~ pattern
suffix = $'
if options[:path].join(suffix).exist?
@theevilbit
theevilbit / launchd-config.plist
Created October 10, 2024 12:22
launchd embedded plist, macOS 15.0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ShutdownReportTimeout</key>
<integer>2</integer>
<key>SIGTERMTimeout</key>
<integer>5</integer>
<key>CrashOnSIGTERMTimeout</key>
<true/>
@EthanArbuckle
EthanArbuckle / cli-gui.m
Last active July 8, 2025 20:08
drawing a UIWindow from an iOS cli tool
#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <objc/message.h>
#import <dlfcn.h>
__attribute__((constructor)) static void init(void) {
Method bundleIdentifierMethod = class_getInstanceMethod(objc_getClass("NSBundle"), sel_registerName("bundleIdentifier"));
IMP newImp = imp_implementationWithBlock(^(id self) {
@niw
niw / 20240929.md
Last active January 23, 2025 20:25
The Hunt for the iOS 18 Neural Engine Bug: A Long Weekend Investigation

The Hunt for the iOS 18 Neural Engine Bug: A Long Weekend Investigation

This is the tale of a long weekend spent uncovering a mysterious iOS 18 Neural Engine bug—a journey of problem-solving in a system where full visibility is elusive, especially in the locked-down world of Apple’s platforms. But the process I followed is a general approach you can use for any opaque system. It all began last week when I stumbled upon a strange behavior in my iOS app. The output generated from a CoreML model was completely broken—something I had never seen before. And after some digging, I realized this only happened when the model was running on the Neural Engine of iOS 18. The first step was triage. I implemented a quick workaround in the app: if the device is running iOS 18, switch from the Neural Engine to the GPU. This temporarily solved the issue, but I had no idea why it worked or whether other CoreML models in the app’s pipeline might also be affected. Without a deeper understanding of the root cause, I knew I cou

resources to find what Apple/Asahi acronyms mean:

  • check out this table
  • search with site:asahilinux.org (maybe they talked about it in the blog)
  • grep the linux and m1n1 repos

some other random acronyms, mostly peripherals of the SoC:

  • AIC → Apple Interrupt Controller
  • AP → Application Processor (where the OS runs)
  • DART → Device Address Resolution Table (IOMMU)
@mildsunrise
mildsunrise / decompress_pbzx.py
Last active December 14, 2024 14:24 — forked from Lekensteyn/parse_pbzx.py
Pure python reimplementation of .cpio.xz content extraction from pbzx file payload for OS X packages
#!/usr/bin/env python3
'''
Decompresses a pbzx stream.
Simplified/corrected version of <https://gist.github.com/Lekensteyn/6e0840e77bc9bd013f57>
Example usage (from Python):
decompress_pbzx(open('PayloadJava', 'rb'), open('PayloadJava.cpio', wb'))
@steveroush
steveroush / addGrid.gvpr
Created September 22, 2024 20:49
add a grid to any Graphviz graph
/**************************************************************************
add a grid to a graph in .dot format
**************************************************************************/
BEGIN{
int i, Indx, bcnt, LR;
string Type, Val, Gcolor[], Gstyle[], Gsize[], tmpstr;
string Hcolor, Vcolor, Hstyle, Vstyle, gridType, gridAlign;
float Hsize, Vsize, deltaX, deltaY, minX, minY, maxX, maxY;