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 / protobuf.nanorc
Last active December 19, 2018 23:50
Protobuf syntax highlighting for nano
## Protobuf syntax highlighting for nano by Leptos
## Based off creekpld's Swift syntax highlighter
syntax "Protobuf" "\.proto$"
# Default
color white ".+"
# Keywords
color yellow "^ *\<(syntax|package|import|option)\>"
@leptos-null
leptos-null / YouTube_Music_Client.md
Last active April 12, 2024 03:31
Writing an iOS YouTube Music client

Writing an iOS YouTube Music client

I’ve been using YouTube Music as my main music streaming service for almost a year and a half. The iOS client is great- I’ve never had a single complaint. It’s potentially one of the most bug free apps I’ve ever used, it has an extremely friendly, and simple, graphical interface, and the service itself is great.

I was curious how the client worked in terms of networking, and while curiosity may treat cats poorly, it lands researchers in black sites can provide a lot of insight.

Step 0

The first thing I do when reverse engineering a client is monitor HTTP requests while the application starts up, and when doing the tasks interested in. On a jailbroken iOS device, I use FLEX by FlipBoard.

@leptos-null
leptos-null / progress_bar.c
Last active April 28, 2019 19:37
Example of a VT100 progress bar in C
//
// progress_bar.c
//
// Created by Leptos on 2/17/19.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@leptos-null
leptos-null / ios_image_app_url_dump.m
Last active May 14, 2023 17:30
Dump URL schemes from an iOS system image (stock applications)
//
// ios_image_app_url_dump
//
// Created by Leptos on 2/19/19.
// Copyright © 2019 Leptos. All rights reserved.
//
/* compile with:
* $ clang -fobjc-arc -framework Foundation
*/
@leptos-null
leptos-null / floating.c
Created March 3, 2019 23:00
Visualizing and understanding IEEE 754 floating point values
//
// floating.c
// funbits
//
// Created by Leptos on 8/18/18.
// Copyright © 2018 Leptos. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@leptos-null
leptos-null / UIOrientationPortableState.h
Created April 26, 2019 04:01
An idea for maintaining orientation state through notify_state
union UIOrientationPortableState {
struct UIOrientationState {
enum UIOrientation { /* this is UIInterfaceOrientation, but unsigned */
UIOrientationUnknown,
UIOrientationPortrait,
UIOrientationPortraitUpsideDown,
UIOrientationLandscapeRight,
UIOrientationLandscapeLeft
}
current : 3, // may be the orientation the device is transitioning to, if transition != UITransitionPhaseZero
@leptos-null
leptos-null / taylor_sin.c
Last active April 28, 2019 19:16
A C sine routine implemented using a Taylor series
//
// taylor_sin.c
//
// Created by Leptos on 4/25/19.
// Copyright © 2019 Leptos. All rights reserved.
//
#include <math.h> // not required- included only for the M_PI macros which are also included below
#include <errno.h> // needed to set errno in the even that the input of sin is an infinity
@leptos-null
leptos-null / mach_slide.c
Last active September 15, 2023 05:21
Function to get the image_vmaddr_slide of a mach_header
//
// mach_slide.c
//
// This code was based on functions from https://opensource.apple.com/source/dyld
// See the Apple Public Source License https://www.opensource.apple.com/apsl
//
// Created by Leptos on 5/11/19.
//
#include <string.h>
@leptos-null
leptos-null / temperature_scaling.md
Last active December 23, 2019 06:00
How to scale temperature and other measurements

Temperature Scaling

What’s it mean if the temperature is going to be 30% warmer or 30% cooler?

Distance Scaling

Let’s take something that we know works: distances. If I have a distance that’s 2 meters, 30% more is (x=2, s=0.3; x*(1+s)) 2.6 meters, and 30% less is (x=2, s=-0.3; x*(1+s)) 1.4 meters. Covert these three values to feet, you get 6.56, 8.53, and 4.59 respectively. If we plug these numbers back into our scaling equation: more is (x=6.56, s=0.3; x*(1+s)) 8.528 feet, and less is (x=6.56, s=-0.3; x*(1+s)) 4.592 feet. These values are slightly off due to rounding.

Fixing Temperature

The problem with temperature is that it’s not zero-based. A value some incremental amount warmer than 5 degrees Fahrenheit is still cold. We need to “normalize” temperature. To do that, we have to find a value such that anything warmer feels warmer, and anything cooler feels cooler. We’re going to use 22°C (72°F) for this value.

@leptos-null
leptos-null / UIStatusBarItemType.m
Last active August 31, 2019 22:43
Recreating the UIStatusBarItemType enum
//
// statusbartypes
//
// Created by Leptos on 3/19/19.
// Copyright © 2019 Leptos. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef int UIStatusBarItemType;