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 / split_log.sh
Created June 2, 2018 05:29
Split v2ray log and delete outdated logs.
#!/bin/bash
LOGPATH=/var/log/v2ray/
TIME=`date +"%Y%m%d %H:%M"`
MAXLOGDAY=20
cd $LOGPATH
# split logs
tar -zcf ${TIME}.log.tgz *.log
cat /dev/null > error.log
cat /dev/null > access.log
# Better work with oh-my-pwsh
# Put below content into $PROFILE
function su-fun {Start-Process powershell -Verb runAs -argumentlist '-NoExit', "cd '$pwd';", "$args"}
set-alias su su-fun
set-alias sudo su-fun
$env:PYTHONIOENCODING="utf-8"
# Remove curl alias
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
@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
@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 / 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

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

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
@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 \
@the-eric-kwok
the-eric-kwok / rjk-repo-mod.zsh-theme
Created September 17, 2022 06:08
rjk-repo 主题,将时间格式更改为 24h
# user, host, full path, and time/date on two lines for easier vgrepping
function hg_prompt_info {
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
hg prompt --angle-brackets "\
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
fi
}
@the-eric-kwok
the-eric-kwok / 使用root跳过小米USB安装应用确认.md
Last active July 11, 2025 09:12
使用root跳过小米USB安装应用确认

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

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

一、背景和结论

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

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