Skip to content

Instantly share code, notes, and snippets.

View Lessica's full-sized avatar

i_82 Lessica

View GitHub Profile
@Lessica
Lessica / TemplateOutlineView.swift
Created April 29, 2021 12:51
An attempt to re-draw 'focus ring' of NSTableView and NSOutlineView.
//
// TemplateOutlineView.swift
// JSTColorPicker
//
// Created by Rachel on 4/16/21.
// Copyright © 2021 JST. All rights reserved.
//
import Cocoa
@Lessica
Lessica / XcodeRegexReplacementCollection.md
Last active May 22, 2021 07:36
Regular expressions to find inconsistencies in .strings

Find All Inconsistencies

(title|ibShadowedToolTip|headerToolTip|placeholderString|label|paletteLabel) = (")(.+?)\2((.|\n)+?)\2\3\2;\n
(")(.*?)\1 = \1\2\1;

Fill Base Localization

@Lessica
Lessica / ssn_mappings.json
Created July 10, 2021 05:39
Prefix List for Social Security Numbers USA
{
"AK": {
"ssn_parts": [
"574"
],
"ssn_prefixes": [
"574"
],
"ssn_sql_parts": [
"LIKE '574%'"
@Lessica
Lessica / expects_json.py
Created July 12, 2021 18:20
Validate JSON request data
def expects_json(obj: dict, schema: tuple):
# or use library `flask-expects-json`
_type = type(obj)
if _type != dict:
raise werkzeug.exceptions.BadRequest(f"wrong type of root object, except dict, got {str(_type.__name__)}")
_keys = schema
for _key in _keys:
assert len(_key) >= 2
if _key[0] not in obj:
if len(_key) >= 3 and _key[2] is False:
@Lessica
Lessica / make_panes.sh
Created July 17, 2021 11:52
Make muliple panes in iTerm
#!/bin/zsh
repeatBy() { for i in {1..$(expr $1)}; do echo -n "$2"; done }
if [ "$#" -lt 2 ]; then
echo "usage: $0 v h [command]"
exit 1
fi
CMD="$3"
@Lessica
Lessica / configure-xcode-for-embedded-development.py
Created March 8, 2022 17:40
iOS Jailbreak Development: Add Command-Line Tool
#!/usr/bin/env python3
#
# Copyright (C) 2014-2020 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@Lessica
Lessica / argon-fan.sh
Created March 25, 2022 17:07
Configure Raspberry Pi + Argon One Case for Lineage OS
#!/system/bin/sh
sleeptime=120
while true
do
cputemp=$(cat /sys/class/thermal/thermal_zone0/temp)
if [[ $cputemp -lt 55000 ]]; then
fanspeed="0x00"
elif [ $cputemp -ge 55000 -a $cputemp -lt 60000 ]; then
fanspeed="0x10"
@Lessica
Lessica / idevicerestore-static-patch.diff
Created April 13, 2022 15:26
Static patch of idevicerestore
diff --git a/src/fdr.c b/src/fdr.c
index ee76de6..c092b0b 100644
--- a/src/fdr.c
+++ b/src/fdr.c
@@ -549,7 +549,7 @@ static int fdr_handle_proxy_cmd(fdr_client_t fdr)
}
/* else wait for messages and forward them */
- int sockfd = socket_connect(host, port);
+ int sockfd = idevicerestore_socket_connect(host, port);
@Lessica
Lessica / daemon-main.m
Created September 7, 2022 07:54
iOS Daemon without Jetsam
#import <Foundation/Foundation.h>
#import <dlfcn.h>
#import <sys/proc.h>
// these headers can be found at https://github.com/apple/darwin-xnu
#import "libproc.h"
#import "kern_memorystatus.h"
static __attribute__ ((constructor(101), visibility("hidden")))
void BypassJetsam(void) {
@Lessica
Lessica / MGCopyAnswer-Tweak.mm
Last active July 30, 2024 06:24
Hook Internal Implementation of MGCopyAnswer (iOS 15)
#import <dlfcn.h>
#import <os/log.h>
#import <substrate.h>
#import <Foundation/Foundation.h>
#import "pac_helper.h"
#define _FUNC_ADDR_(A, O) (const void *)((long)(A) + (O))
/* ... */