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 / 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 / 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 / UIImageUnicode.m
Last active October 19, 2020 18:49
Draw UIImage of Unicode character
@implementation UIImage (UIImageUnicode)
+ (UIImage *)imageFromUnicodePoint:(unichar)codepoint compatibleWithTraitCollection:(UITraitCollection *)traitCollection API_AVAILABLE(ios(10.0)) {
NSString *str = [NSString stringWithCharacters:&codepoint length:1];
UIFont *weightRef = [UIFont preferredFontForTextStyle:UIFontTextStyleBody compatibleWithTraitCollection:traitCollection];
UIFont *sizeRef = [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2 compatibleWithTraitCollection:traitCollection];
NSAttributedString *drawReady = [[NSAttributedString alloc] initWithString:str attributes:@{
NSFontAttributeName : [weightRef fontWithSize:sizeRef.pointSize]
}];
UIGraphicsBeginImageContextWithOptions([drawReady size], NO, 0);
@leptos-null
leptos-null / ARCBlood.md
Created April 12, 2020 16:56
Red Cross Blood REST API Reference

Red Cross Blood REST API Reference

This guide is based on research from version 1.7.3 of Red Cross Blood iOS app.

Host: blood.arc.cubeapis.com

This reference is for version 2.1 of the interface.

Authentication

@leptos-null
leptos-null / open_app.m
Created August 28, 2019 05:42
[iOS] Open an application from the command line by bundle identifier
@import Foundation;
@import MobileCoreServices;
API_AVAILABLE(ios(5.0))
@interface LSApplicationWorkspace : NSObject
+ (instancetype)defaultWorkspace;
- (BOOL)openApplicationWithBundleID:(NSString *)bundleID API_AVAILABLE(ios(7.0));
@end
@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.

Keybase proof

I hereby claim:

  • I am leptos-null on github.
  • I am leptos_null (https://keybase.io/leptos_null) on keybase.
  • I have a public key ASA0dcmIggGRcMrdxDzFRDAutr7TdLveEOWsHbCkWeWN0Qo

To claim this, I am signing this object:

@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 / watchPreviewDate.m
Created September 19, 2019 05:10
The date used for previews on watchOS, primarily for complications
static NSDate *watchPreviewDate() {
static NSDateComponents *comps;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
comps = [NSDateComponents new];
comps.calendar = NSCalendar.autoupdatingCurrentCalendar;
comps.timeZone = NSTimeZone.localTimeZone;
comps.year = 2014;
comps.month = 9;
comps.day = 9;
@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;