Skip to content

Instantly share code, notes, and snippets.

// Works on iOS 16 and later. Works by hooking backboardd.
// { Filter = { Executables = ( "backboardd" ); }; }
#import <UIKit/UIKit.h>
@interface BKTouchContact : NSObject {
CGPoint _normalLocation;
}
@end
@interface BKTouchContactSet : NSObject {
// ==UserScript==
// @name Tranmsmission Web Magnets
// @version 1.0
// @description Adds "Copy Magnet Link" option to Transmission Web
// @author pixelomer
// @match *://*:9091/*
// @grant none
// @run-at document-end
// ==/UserScript==
@pixelomer
pixelomer / CommonMistakes.md
Last active September 4, 2021 16:18
Common mistakes in tweak development

Common mistakes in tweak development

This gist contains a list of mistakes I've made or seen people make in the past. These are my opinions, so don't treat them as facts. If you disagree with anything you see here, please let me know.

Adding subviews from [-[UIView layoutSubviews]][layoutSubviews]

[-[UIView layoutSubview]][layoutSubviews] is a method that is responsible for adjusting the positions of subviews after something caused the existing layout to be invalidated. There can be various reasons for this. For example, the bounds of the view may have changed or some code may have called [-[UIView setNeedsLayout]][setNeedsLayout]. The point is, regardless of why this method got called, this method gets called a lot. Its only purpose is adjusting the layout of the view to match the new conditions. It is not for adding new subviews to a view.

Using Logos directives improperly

@pixelomer
pixelomer / OSUBeatmap.h
Created March 7, 2021 12:35
osu! beatmap metadata parser written in Objective-C
#import <Foundation/Foundation.h>
NSDictionary *OSUParseBeatmap(NSURL *beatmapURL);
@pixelomer
pixelomer / longest-selector-finder.m
Created March 3, 2021 16:28
Small Objective-C program for finding the longest built-in method name
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
static void LoadAllFrameworks(NSString *root) {
NSFileManager *defaultManager = [NSFileManager defaultManager];
NSDirectoryEnumerator *enumerator = [defaultManager
enumeratorAtURL:[NSURL fileURLWithPath:root]
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsSubdirectoryDescendants
errorHandler:nil
@pixelomer
pixelomer / joycontrol-autocapture.py
Created January 6, 2021 13:26
Script for automatically triggering a video recording on a Switch once every 25 seconds
#!/usr/bin/env python3
import asyncio
import logging
import os
from aioconsole import ainput
from joycontrol import logging_default as log, utils
from joycontrol.command_line_interface import ControllerCLI
#!/usr/bin/env python3
# This script creates a message that abuses Janet the Discord
# bot to print a minesweeper field
import json
from sys import stdout
from random import randint
BOMB_CELL = 9
- (BOOL)executeQuery:(NSString *)query
parameters:(NSArray<__kindof NSObject *> *)params
block:(BOOL(^)(NSArray<NSString *> *, NSArray *))block
{
sqlite3_stmt *stmt = NULL;
int status = sqlite3_prepare_v2(_databaseHandle, query.UTF8String, -1, &stmt, NULL);
if (status != SQLITE_OK) {
if (stmt) sqlite3_finalize(stmt);
return NO;
}
#import <UIKit/UIKit.h>
@interface SpringBoard : UIApplication
- (BOOL)isLocked;
- (id)_accessibilityFrontMostApplication;
@end
static void NVAHVolumeHook(id self, SEL _cmd, id arg1, IMP orig) {
SpringBoard *springboard = (id)UIApplication.sharedApplication;
id frontmostApp = [springboard _accessibilityFrontMostApplication];
@pixelomer
pixelomer / CleanTube.xm
Created September 22, 2019 13:36
Incomplete tweak
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
#define NSLog(args...) NSLog(@"[CleanTube] "args)
static NSString * const reuseIdentifier = @"CleanTubeCell";
@interface YTAsyncCollectionView : UICollectionView<UICollectionViewDataSource>
@property (nonatomic, retain) NSMutableArray<NSIndexPath *> *cleanIndexPaths;
@end