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

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 / git-wrap-gitlens.bat
Last active May 25, 2021 15:52
Use msys2 git on vscode
@echo off
setlocal
rem https://github.com/eamodio/vscode-gitlens/issues/965#issuecomment-734013893
set PATH=%~dp0usr\bin;%PATH%
:loop
if "%~1" equ "rev-parse" goto rev_parse
shift
@pexcn
pexcn / Solarized Darcula.xcs
Created April 28, 2021 03:57
Xshell 7 themes
[Solarized Darcula]
text=d2d8d9
cyan(bold)=15968d
text(bold)=d2d8d9
magenta=797fd4
green=629655
green(bold)=629655
background=3d3f41
cyan=15968d
red(bold)=f24840
@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 / SO_RCVBUF_and_SO_SNDBUF.md
Last active June 9, 2021 01:17
SO_RCVBUF and SO_SNDBUF settings
BDP = Bandwidth * RTT

e.g.:

Server
SO_RCVBUF: 125000000Bytes (1000Mbps), 0.02s (20ms)
125000000Bytes * 0.02s = 2500000Bytes
SO_SNDBUF: 125000000Bytes (1000Mbps), 0.165s (165ms)
125000000Bytes * 0.165s = 20625000Bytes
@pexcn
pexcn / modern_crypto.md
Created April 20, 2021 06:36 — forked from byronhe/modern_crypto.md
现代密码学实践指南[2015年]

现代密码学实践指南[2015年]

标签(空格分隔): 密码学


本文介绍目前现代密码学的最先进技术, 前半部分主要翻译自 《Cryptographic Right Answers》,附上收集的资料,和byron个人的理解。

@pexcn
pexcn / shadowsocks-speedtests.md
Last active January 3, 2025 09:49
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 / ss-libev-iperf.sh
Last active April 19, 2021 04:25
shadowsocks-libev 和 shadowsocks-rust 的 iperf 速度测试脚本
#!/bin/bash -e
METHOD="$1"
# prepare
docker stop iperf-client ss-client ss-server iperf-server &>/dev/null || true
docker rm iperf-client ss-client ss-server iperf-server &>/dev/null || true
# iperf server
docker run -d --rm --name iperf-server --network host pexcn/docker-images:iperf -s -B 127.0.0.1 -p 10000 >/dev/null
@pexcn
pexcn / he-ddns.sh
Last active March 9, 2021 19:08
Simple DDNS script for Hurricane Electric (dns.he.net)
#!/bin/sh -e
#
# Hurricane Electric DDNS script for OpenWrt
#
# crontab: */5 * * * * INTERFACE=pppoe-wan USE_PEERDNS=1 DOMAIN=example.com KEY=password /usr/bin/he-ddns.sh
#
set -o pipefail
INTERFACE="${INTERFACE:-pppoe-wan}"
DOMAIN="${DOMAIN:-example.com}"
# unpack
bsdcpio -id < ../extra.lzma

# repack
find . | cpio -o --format='newc' --owner root:root | lzma > ../extra.lzma