Skip to content

Instantly share code, notes, and snippets.

View leptos-null's full-sized avatar
🏔️
Darwin tooling

Leptos leptos-null

🏔️
Darwin tooling
View GitHub Profile
@leptos-null
leptos-null / inspectivec.cy
Last active December 15, 2018 23:31
InspectiveC module for Cycript
/* InspectiveC by DavidGoldman
* Place this file in `/usr/lib/cycript0.9/com/golddavid/inspectivec.cy`
* Run `@import com.golddavid.inspectivec` in cycript to use.
*
* This file has been adapted from
* https://github.com/DavidGoldman/InspectiveC/blob/master/cycript/InspectiveC.cy
* to use new cycript module features.
*
* This module is based on
* https://github.com/limneos/classdump-dyld/blob/master/classdumpdyldlib/classdumpdyld.cy
@leptos-null
leptos-null / printBitRepresentation.h
Last active September 2, 2018 01:49
Three macros for printing the bit representation of a fixed-point value
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
/* prints each character representation of the byte one at a time.
* no memory management required; slower, than using a buffer.
*/
#define printBitRepresentationEach(a) \
({ \
for (size_t _i = (sizeof(a) * CHAR_BIT); _i; _i--) { \
@leptos-null
leptos-null / cydia-virtual-dependencies.md
Last active September 24, 2019 09:35
Explanation of Cydia-provided "virtual dependency" packages

Cydia Virtual Dependency Packages

Cydia provides "virtual dependency" packages, leveraging dpkg, to allow packages to only be installed on certain kinds of devices.

I have not been able to find official documentation on these packages. Their package names are prefixed with "cy+". To find out exactly what these packages represented I ran a few command on two devices.

Testing

iPhone 5, iOS 10.3.3:

@leptos-null
leptos-null / llvm.nanorc
Last active January 21, 2022 09:19
LLVM syntax highlighting for nano
## LLVM syntax highlighting for nano by Leptos
## Based off the official nano C/C++ template
syntax ll "\.ll$"
magic "LLVM source"
comment ";"
# all numeral literals
color brightcyan "-?[0-9]*"
@leptos-null
leptos-null / lw.zsh
Last active September 21, 2018 22:19
List which: zsh function to print full information about a command
function lw() {
for ARG in "$@"
do
WHICH_RESULT=$(which "$ARG") && {
[[ -e "$WHICH_RESULT" ]] && {
l "$WHICH_RESULT"
continue
}
}
echo "$WHICH_RESULT"
@leptos-null
leptos-null / polymaths.c
Last active September 21, 2018 15:23
Implementation of Descartes' Rule of Signs and Rational Zeros Theorem to show information about a given rational polynomial
//
// main.c
// polymaths
//
// Created by Leptos on 9/18/18.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <math.h>
@leptos-null
leptos-null / cycript-mojave.md
Last active April 4, 2023 18:48
Using cycript on macOS Mojave

Cycript on Mojave

Cycript is a tool I find very helpful. It's an effective REPL for Objective-C. When I updated to macOS Mojave, I found that cycript no longer worked because it was linked against an old version of Ruby. After attempting to compile from source, I tried another solution. install_name_tool is an open source tool for modifying the names of linked shared libraries in a Mach-O.

Solution

$ install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.dylib Cycript.lib/cycript-apl
$ install_name_tool -change /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.dylib Cycript.lib/libcycript.dylib
@leptos-null
leptos-null / Mojave-dynamic-wallpapers.md
Last active April 29, 2021 12:26
Mojave Dynamic Desktop- How it works

Mojave Dynamic Desktop- How it works

Prompted by a tweet by NSHipster, and a subsequent thread, I wanted to find out how Mojave dynamic wallpapers worked. NSHipster and ole reverse engineered the file format. In the Twitter thread, NSHipster mentions an edge case: What happens above 66ºN (latitude)?

The first thing to do was find out what process handles the wallpaper on macOS. I primarily do iOS research, and honestly had no idea. I opened Console, searched for "solar", and then changed my static wallpaper to a dynamic one. Voila!

Message: index: 7 next: 14815.999366

Process: Dock

@leptos-null
leptos-null / LMApiaryDeviceCrypto.h
Last active April 12, 2024 03:28
Fully implemented mirror of YouTube's YTApiaryDeviceCrypto class
//
// LMApiaryDeviceCrypto.h
//
// Created by Leptos on 11/18/18.
// Copyright © 2018 Leptos. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kYouTubeBase64EncodedProjectKey @"vOU14u6GkupSL2pLKI/B7L3pBZJpI8W92RoKHJOu3PY="
@leptos-null
leptos-null / YTIThumbnailDetails.md
Last active December 15, 2018 22:57
Odd encoding in YTIThumbnailDetails property list

YTIThumbnailDetails classdump notes

While class dumping YouTube Music, I ran into two problematic properties in a protobuf-generated class.

The property largestImageSource had the type encoding

{YTImageSource=@@{YTClientResource=@@{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}}{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}{optional<unsigned int>=B(?={dummy_type=[4{empty_struct=}]}I)}}