Skip to content

Instantly share code, notes, and snippets.

View pexcn's full-sized avatar
🇹🇼

Sing Yu Chan pexcn

🇹🇼
  • Earth ⇄ Venus
  • Cantonia, West Taiwan
View GitHub Profile

Unpack Android system.new.dat.br

pacman -S brotli p7zip
curl -L -o /usr/local/bin/sdat2img.py https://github.com/xpirt/sdat2img/raw/master/sdat2img.py && chmod +x sdat2img.py

brotli -d system.new.dat.br
sdat2img.py system.transfer.list system.new.dat system.img
7z -y -bsp0 -bso0 x system.img

Fix magisk stock backup does not exist

# put stock boot.img into /sdcard/boot.img

# get sha1
adb shell
su
SHA1=$(cat $(magisk --path)/.magisk/config | grep SHA1 | cut -d '=' -f 2)
@pexcn
pexcn / alpine.sh
Created April 21, 2021 16:52 — forked from trimsj/alpine.sh
Converts OpenVZ VPS to Alpine Linux
#!/bin/sh -e
# Converts OpenVZ VPS to Alpine Linux
# WARNING: This script will wipe any data in your VPS!
# GPLv2; Partly based on https://gitlab.com/drizzt/vps2arch
server=http://images.linuxcontainers.org
path=$(wget -O- ${server}/meta/1.0/index-system | \
grep -v edge | awk '-F;' '($1=="alpine" && $3=="amd64") {print $NF}' | tail -1)
cd /
@pexcn
pexcn / qcom-ipq60xx-cpxx.dts
Created October 3, 2023 17:02 — forked from macromorgan/qcom-ipq60xx-cpxx.dts
Xiaomi AX1800 Device Tree
/dts-v1/;
/ {
MP_256;
model = "Qualcomm Technologies, Inc. IPQ6018/AP-CP02-C1";
compatible = "qcom,ipq6018-cp02", "qcom,ipq6018";
qcom,msm-id = <0x192 0x00>;
#address-cells = <0x02>;
#size-cells = <0x02>;
interrupt-parent = <0x01>;
@pexcn
pexcn / shadowsocks-speedtests.md
Last active August 20, 2023 12:28
Shadowsocks 各加密方式的速度测试报告

Shadowsocks 各加密方式的速度测试报告

TL;DR (仅针对当前版本)

  • 若不知道 CPU 是否支持 AES-NI, 则 chacha20-ietf-poly1305 为最稳妥的选择。
  • 若 CPU 支持 AES-NI, 则 shadowsocks-rust 选择 aes-128-gcm, shadowsocks-libev 选择 aes-256-gcm 为最佳。
@pexcn
pexcn / ChinaDNS Flow.md
Last active February 6, 2023 03:03
记录一下 ChinaDNS 的工作原理和一些 DNS 相关的想法

ChinaDNS 的工作流程

ChinaDNS 的上游 DNS 分为 国内 DNS可信 DNS

工作流程

  1. ChinaDNS 会同时向上游的 DNS 发送请求。
  2. 如果 可信 DNS 先返回,则直接采用 可信 DNS 的结果。
  3. 如果 国内 DNS 先返回,分两种情况:如果返回的结果是国内的 IP, 则采用;否则丢弃并转而采用 可信 DNS 的结果。
@pexcn
pexcn / upload-github-release-asset.sh
Created November 7, 2022 02:26 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
#!/usr/bin/env bash
CIPHERS='ALL:eNULL'
DELAY=${2:-0.1}
SERVER=${1:?usage: $0 <host:port> [delay, default is ${DELAY}s] [ciphers, default is ${CIPHERS}]}
MAXLEN=$(openssl ciphers "$CIPHERS" | sed -e 's/:/\n/g' | awk '{ if ( length > L ) { L=length} }END{ print L}')
echo Using $(openssl version).
declare -A TLSMAP=( [tls1_1]=cipher [tls1_2]=cipher [tls1_3]=ciphersuites )
@pexcn
pexcn / hh_repart
Last active July 5, 2022 09:53
System partition resize script for Nexus 5.
#!/sbin/sh
#
# Copyright (C) 2018 Unlegacy Android Project
# Copyright (C) 2018 Svyatoslav Ryhel
# Copyright (C) 2019 Nick80835
# Copyright (C) 2019 z3dd3r
#
# Made for Hammerhead
#
@pexcn
pexcn / microsoft_edge_uninstaller_21h1_ltsc.bat
Created May 28, 2022 16:35 — forked from ishad0w/microsoft_edge_uninstaller_21h1_ltsc.bat
Microsoft Edge Uninstaller [Windows 10 LTSC 2021/21H1 Edition]
@echo off
@title Microsoft Edge Uninstaller [Windows 10 LTSC 2021/21H1 Edition]
ver
echo+
goto check_admin_permissions
:check_admin_permissions
echo Script must Run as Administrator! Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (