Skip to content

Instantly share code, notes, and snippets.

View daydreamboy's full-sized avatar
🎯
Focusing

daydreamboy

🎯
Focusing
View GitHub Profile
@daydreamboy
daydreamboy / FadeScrollView.swift
Created February 22, 2024 05:40 — forked from luismachado/FadeScrollView.swift
Custom UIScrollView with fade effect
//
// FadeScrollView.swift
//
// Created by Luís Machado on 23/06/2017.
// Copyright © 2017 Luis Machado. All rights reserved.
//
import UIKit
class FadeScrollView: UIScrollView, UIScrollViewDelegate {
require 'optimist'
require 'plist'
# Setups of source path mapping for the framework at framework_path,
# which has a dsym at dsym_path. It maps the source paths to the
# source_path root. Implementation borrowed from https://medium.com/@maxraskin/background-1b4b6a9c65be
def setup_dsym_source_mapping(framework_path, dsym_path, source_path)
binary_uuids = get_uuids_of_dwarf(framework_path)
dsym_uuids = get_uuids_of_dwarf(dsym_path)
verify_uuids(binary_uuids, dsym_uuids)
@daydreamboy
daydreamboy / Makefile
Created June 21, 2023 02:32 — forked from neil-wu/Makefile
HOOK C++ FUNCTION
SDK=/var/root/code/iPhoneOS7.1.sdk
CCPP=clang++ -isysroot $(SDK)
CC=clang -isysroot $(SDK)
all: cat cat.dylib
clean:
rm -f cat cat.dylib
As of iOS 11/macOS High Sierra, and only including ones in Foundation and CoreFoundation
Strings:
_NSCFString - a CFStringRef or CFMutableStringRef. This is the most common type of string object currently.
- May have 8 bit (ASCII) or 16 bit (UTF-16) backing store
_NSCFConstantString - a compile time constant CFStringRef, like you'd get with @"foo"
- May also be generated by dynamic string creation if matches a string in a pre-baked table of common strings called the StringROM
NSBigMutableString - an NSString backed by a CFStorage (https://github.com/opensource-apple/CF/blob/master/CFStorage.h) for faster handling of very large strings
NSCheapMutableString - a very limited NSMutableString that allows for zero-copy initialization. Used in NSFileManager for temporarily wrapping stack buffers.
@daydreamboy
daydreamboy / Makefile
Created March 29, 2023 10:46 — forked from rweichler/Makefile
HOOK C++ FUNCTION
SDK=/var/root/code/iPhoneOS7.1.sdk
CCPP=clang++ -isysroot $(SDK)
CC=clang -isysroot $(SDK)
all: cat cat.dylib
clean:
rm -f cat cat.dylib
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@daydreamboy
daydreamboy / GHRunLoopWatchdog.h
Created March 7, 2023 02:10 — forked from jspahrsummers/GHRunLoopWatchdog.h
A class for logging excessive blocking on the main thread
/// Observes a run loop to detect any stalling or blocking that occurs.
///
/// This class is thread-safe.
@interface GHRunLoopWatchdog : NSObject
/// Initializes the receiver to watch the specified run loop, using a default
/// stalling threshold.
- (id)initWithRunLoop:(CFRunLoopRef)runLoop;
/// Initializes the receiver to detect when the specified run loop blocks for
@daydreamboy
daydreamboy / echo_test.c
Created December 23, 2022 03:35 — forked from lichray/echo_test.c
A kqueue(2) example, read from stdin and echo.
/* Copyright (C) 2002 by Jilles Tjoelker */
/* revised by Zhihao Yuan, 2012 */
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
#include <err.h>
#include <fcntl.h>
#include <signal.h>
@daydreamboy
daydreamboy / mach.org
Created December 5, 2022 02:21 — forked from tom-seddon/mach.org
Random Mach notes

Random Mach notes

mach_thread_self increments ref count

Each call to mach_thread_self adds another MACH_PORT_RIGHT_SEND refcount. For each call to mach_thread_self, you need to call mach_port_deallocate on the result.

(This does not apply to mach_task_self.)

@daydreamboy
daydreamboy / main.m
Created June 22, 2022 16:17 — forked from pudquick/main.m
Load Mach-O executable at runtime and execute its entry point
void callEntryPointOfImage(char *path, int argc, char **argv)
{
void *handle;
int (*binary_main)(int binary_argc, char **binary_argv);
char *error;
int err = 0;
printf("Loading %s…\n", path);
handle = dlopen (path, RTLD_LAZY);