Skip to content

Instantly share code, notes, and snippets.

View the-eric-kwok's full-sized avatar
😉

EricKwok the-eric-kwok

😉
View GitHub Profile
@the-eric-kwok
the-eric-kwok / nskeyvalueobserving.md
Created January 16, 2026 02:54
Using NSKeyValueObserving in KMP

Place this file under composeApp/src/nativeInterop/cinterop/nskeyvalueobserving.def

# https://slack-chats.kotlinlang.org/t/528792/hello-is-it-possible-to-use-in-kotlin-addobserver-on-nsobjec#968aa67c-9166-41c6-b44c-d549a377c08e
package = platform.foundation
language = Objective-C
---
#import <Foundation/Foundation.h>

@protocol NSKeyValueObserving
@required
@the-eric-kwok
the-eric-kwok / 使用root跳过小米USB安装应用确认.md
Last active November 7, 2025 02:52
使用root跳过小米USB安装应用确认

转自——使用root跳过小米USB安装应用确认(续) | LeadroyaL's website

最近又抓来一台小米手机当测试机,部署环境时候发现了新的 usb 相关功能的修改方式。

一、背景和结论

众所周知,小米手机开启 USB 安装功能,需要插入 SIM 卡登陆、需要登小米账号。我这台手机已root,懒得登陆了,就准备通过修改文件的方式来开启相关功能,还真做到了。 关键词:root,无需 xposed,无需 frida。 测试环境:miui9、miui10、miui11、miui12。

二、无需 SIM卡和小米账号,开启USB相关功能

@the-eric-kwok
the-eric-kwok / typora_uploader.sh
Last active January 23, 2023 05:16
Typora 使用 sm.ms 上传命令
#!/bin/bash
API_KEY="" # 这里填入 sm.ms 的 API key
for item in "$@"; do
curl -s -X POST \
-F "smfile=@${item}" \
-H "Content-Type: multipart/form-data" \
-H "Authorization: ${API_KEY}" \
https://smms.app/api/v2/upload \

Disable AppleI2C

In clover config.plist, KernelAndKextPatches -> KextsToPatch

Comment:         Prevent Apple I2C kexts from attaching to I2C controllers, credit CoolStar
Find:            494F4B6974
Replace:         494F4B6973
Name:            com.apple.driver.AppleIntelLpssI2C
InfoPlistPatch:  YES

https/http 协议的执行:

# 设置 http 代理
git config --global https.proxy http://127.0.0.1:8080

# 或 socks5 代理
git config --global http.proxy socks5h://127.0.0.1:1080

# 取消代理
git config --global --unset http.proxy
@the-eric-kwok
the-eric-kwok / mount_efi.command
Last active April 2, 2021 04:33
Mount ESP on macOS.
#!/bin/zsh
DISKS=($(diskutil list | grep -i efi | grep -o "disk[0-9]s[0-9]"))
for disk in $DISKS; do
echo "正在挂载 $disk..."
sudo diskutil mount $disk
done
open /Volumes
@the-eric-kwok
the-eric-kwok / clover_boot_flags.md
Created February 9, 2021 08:56 — forked from pjobson/clover_boot_flags.md
Clover Boot Flags

Clover Boot Flags

Flag Description
-v Verbose Mode
-x Safe Mode
-s Single User Mode
-no-zp Zone Postponing (use if hanging)
cpus=1 Single CPU Core Mode
-f No Kext Cache Mode (use if hanging)
@the-eric-kwok
the-eric-kwok / fake_apple_mouse.py
Last active February 11, 2021 05:21
A script to modify VirtualSMC.kext or FakeSMC.kext for faking non-apple mouse.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import plistlib
from shutil import copyfile
files = ["/Volumes/EFI/EFI/OC/Kexts/VirtualSMC.kext/Contents/Info.plist",
"/Volumes/EFI/EFI/OC/Kexts/FakeSMC.kext/Contents/Info.plist"]
idProduct = 9486
idVendor = 16700