Skip to content

Instantly share code, notes, and snippets.

@JohnCoates
JohnCoates / install-api.py
Created March 5, 2020 09:18 — forked from withzombies/install-api.py
Install the Binary Ninja Python API
#!/usr/bin/env python
import os
import sys
import os.path
import site
try:
import binaryninja
print "Binary Ninja API Installed"
@JohnCoates
JohnCoates / Future+NilMap.swift
Created March 10, 2019 23:54
Mapping on nil for Vapor 3
//
// Future+NilMap.swift
// Created on 3/10/19
//
import Async
public protocol OptionalConstrainable {
associatedtype Element
var asOptional: Optional<Element> { get }
@JohnCoates
JohnCoates / decodeHiddenInstagramAPIKey.swift
Last active August 8, 2023 17:50
Instagram private key decoder
let encodedApiKey = [0x72, 0x30, 0x39, 0x04, 0x04, 0x88, 0x72, 0x88, 0x72, 0xEE, 0x04, 0x30, 0x04, 0xEF, 0xEB, 0xC2,
0xEB, 0xEE, 0xAA, 0x41, 0xEE, 0x30, 0x88, 0xC2, 0xC2, 0x2C, 0x04, 0x04, 0x88, 0xAA, 0x41, 0x30,
0x41, 0x72, 0x88, 0x5D, 0x04, 0x2C, 0xAA, 0x58, 0x30, 0x72, 0xEE, 0x39, 0x58, 0xEE, 0xC2, 0x5D,
0xAA, 0x04, 0xE2, 0xEE, 0x58, 0xE2, 0xEE, 0x5D, 0xAA, 0x2C, 0x41, 0x04, 0x88, 0xE2, 0xAA, 0xC2]
let map: [Int: String] = [
0x04: "3",
0x2c: "d",
0x30: "b",
0x39: "c",
@JohnCoates
JohnCoates / Readme.md
Last active September 27, 2021 20:24
HEVC HLS Creation
@JohnCoates
JohnCoates / commands.sh
Last active May 6, 2021 22:00
THEOS on Windows 10 with Linux subsystem
# Turn on Developer Mode
# Open Settings -> Update and Security -> For developers
# Don't reboot yet
# Run in powershell administrator:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
# accept reboot
## Install Ubuntu
# run in powershell administrator:
@JohnCoates
JohnCoates / resetSimulators.rb
Created August 22, 2017 04:22
Keep only your favorite iOS simulators
# from https://gist.github.com/cabeca/cbaacbeb6a1cc4683aa5
#!/usr/bin/ruby
STDOUT.sync = true
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
@JohnCoates
JohnCoates / debugHook.py
Created August 21, 2017 03:44
Hook Python function calls for debugging
import subprocess
import os
def hook(hookfunc, oldfunc):
def foo(*args, **kwargs):
hookfunc(*args, **kwargs)
return oldfunc(*args, **kwargs)
return foo
def printFunction(*args, **kwargs):
@JohnCoates
JohnCoates / UITableView+Cells.swift
Created June 19, 2017 22:11
UITableView typed cells
extension UITableView {
func registerCell<CellType: UITableViewCell>(type: CellType.Type) {
register(type, forCellReuseIdentifier: String(describing: type))
}
func dequeueReusableCell<CellType: UITableViewCell>(for indexPath: IndexPath) -> CellType {
let identifier = String(describing: CellType.self)
let untypedCell = dequeueReusableCell(withIdentifier: identifier, for: indexPath)
@JohnCoates
JohnCoates / AutoHook.h
Created May 26, 2017 22:06
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end
@JohnCoates
JohnCoates / FixUICodeCoverage
Created May 19, 2017 15:28
Fixes UI code coverage on builds run from xcode build
@import ObjectiveC.runtime;
@import MachO.dyld;
@import Foundation;
@interface IDELaunchParametersSnapshot : NSObject
+ (id)launchParametersWithSchemeIdentifier:(id)schemeIdentifier
launcherIdentifier:(id)launcherIdentifier
debuggerIdentifier:(id)debuggerIdentifier
launchStyle:(int)launchStyle
runnableLocation:(id)runnableLocation