Skip to content

Instantly share code, notes, and snippets.

View PoomSmart's full-sized avatar
💻

Thatchapon Unprasert PoomSmart

💻
View GitHub Profile
@PoomSmart
PoomSmart / build-rootless.sh
Last active February 12, 2024 14:09
Shell script to build your tweaks compatible with rootless jailbreak.
#!/usr/bin/env bash
set -e
PROJECT="$1"
if [ -z "$PROJECT" ]; then
echo "Usage: $0 <project>"
exit 1
fi
@PoomSmart
PoomSmart / RemoveDeviceChallenge.xm
Created August 21, 2022 12:10
Allow sideloaded iOS YouTube app to sign in by removing device_challenge_request from the sign in payload.
// Credit: https://github.com/qnblackcat/uYouPlus/pull/398
%hook SSOService
+ (id)fetcherWithRequest:(NSMutableURLRequest *)request configuration:(id)configuration {
if ([request isKindOfClass:[NSMutableURLRequest class]] && request.HTTPBody) {
NSError *error = nil;
NSMutableDictionary *body = [NSJSONSerialization JSONObjectWithData:request.HTTPBody options:NSJSONReadingMutableContainers error:&error];
if (!error && [body isKindOfClass:[NSMutableDictionary class]]) {
[body removeObjectForKey:@"device_challenge_request"];
@PoomSmart
PoomSmart / ContainsEmoji.m
Last active April 7, 2023 02:08
Detect if string contains emoji (Using Objective-C and Swift)
#import <UIKit/UIKit.h>
#import <CoreFoundation/CoreFoundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <CoreText/CoreText.h>
@interface EmojiUtilities : NSObject
+ (CFMutableCharacterSetRef)emojiCharacterSet;
+ (BOOL)containsEmoji:(NSString *)emoji;
@end
@PoomSmart
PoomSmart / ReadEntitlements.x
Last active February 16, 2022 23:11
Read the entitlements of iOS application at run-time
#import <substrate.h>
#import <HBLog.h>
typedef struct __CFRuntimeBase {
uintptr_t _cfisa;
uint8_t _cfinfo[4];
#ifdef __LP64__
uint32_t _rc;
#endif
} CFRuntimeBase;
@PoomSmart
PoomSmart / PVC.x
Created December 22, 2021 13:24
iOS YouTube Logging
void (*YTPlayerLogPVC)(NSString *, ...);
%hookf(void, YTPlayerLogPVC, NSString *format, ...) {
va_list args;
va_start(args, format);
NSLogv(format, args);
va_end(args);
}
%ctor {
NSString *frameworkPath = [NSString stringWithFormat:@"%@/Frameworks/Module_Framework.framework/Module_Framework", NSBundle.mainBundle.bundlePath];
@PoomSmart
PoomSmart / enable-text-recognition.sh
Last active August 19, 2021 04:53
Enable Live Text Recognition on Intel-based Mac running macOS Monterey (12.0b1)
#!/bin/bash
APP_TARGETS=(com.apple.Photos com.apple.Preview com.apple.quicklook.QuickLookUIService com.apple.Safari)
for APP_TARGET in "${APP_TARGETS[@]}"
do
defaults write /Users/$USER/Library/Containers/$APP_TARGET/Data/Library/Preferences/com.apple.VisionKit.InternalSettings com.apple.VisionKit.InternalSettings.overrideDeviceAvailability -bool yes
done
@PoomSmart
PoomSmart / ActionSheet.m
Created July 13, 2021 12:52
YouTube action sheet and notification things
@interface YTUIUtils : NSObject
+ (UIViewController *)topViewControllerForPresenting;
@end
@interface YTUIResources : NSObject
+ (UIImage *)iconCheckTemplateImage;
+ (UIImage *)actionsheetDefaultImage;
@end
@interface YTActionSheetAction : NSObject
@PoomSmart
PoomSmart / MyCourses-BulkDownload.js
Last active January 7, 2021 13:42
Adding a button to bulk download all the lecture slides of each course (Use Tampermonkey).
// ==UserScript==
// @name MyCourses-BulkDownload
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mycourses.ict.mahidol.ac.th/course/view.php?id=*
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.5/jszip.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip-utils/0.0.2/jszip-utils.min.js
// @require https://fastcdn.org/FileSaver.js/1.1.20151003/FileSaver.min.js
@PoomSmart
PoomSmart / sort3.asm
Created December 28, 2018 08:23
Shortest Code to Sort 3 Numbers known to man?
%include "asm_io.inc"
extern _printf
segment data align=4 class=data use32
EnterOne db "Enter number 1: ", 0
EnterTwo db "Enter number 2: ", 0
EnterThree db "Enter number 3: ", 0
FormattedAnswer db "%d %d %d", 0
@PoomSmart
PoomSmart / commands.sh
Created July 8, 2018 11:09 — forked from JohnCoates/commands.sh
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: