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
@pexcn
pexcn / java_extract.bat
Created September 5, 2018 13:31 — forked from milolav/java_extract.bat
Batch file to extract portable version of java jre or jdk from installer
@echo off
rem Batch file that extracts java from installer
rem Original topic on stackoverflow:
rem http://stackoverflow.com/questions/1619662/how-can-i-get-the-latest-jre-jdk-as-a-zip-file-rather-than-exe-or-msi-installe
setlocal
if [%1]==[] goto usage
set fn=%~n1
7z.exe e %1 .rsrc\1033\JAVA_CAB10\111
if errorlevel 1 goto err
@pexcn
pexcn / auto-sign.sh
Created March 4, 2018 11:54
china unicom mobile client auto sign script
#!/bin/bash -xe
# Replace ******** with your token
export SIGN_IN_URL=http://m.client.10010.com/SigninApp/signin/querySigninActivity.htm?token=********
export DAY_SIGN_URL=http://m.client.10010.com/SigninApp/signin/daySign.do
export SCRIPT_PATH=$(dirname $0)
echo "$(date +'%Y-%m-%d %T')" >> $SCRIPT_PATH/log.txt
curl $SIGN_IN_URL \
@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 的结果。

ChinaDNS

Deprecated

git clone https://github.com/pexcn/ChinaDNS.git && pushd ChinaDNS
./autogen.sh
CFLAGS="-O3 -ffast-math" ./configure --enable-static
make
strip src/chinadns.exe
popd
@pexcn
pexcn / patch-rtc.py
Last active September 15, 2015 09:49 — forked from Lekensteyn/patch-rtc.py
Script to patch an Android recovery.img file, changing the qcom,qpnp-rtc-write Device Tree property (tested with an Android 5.1 image based on kernel 3.4 for a Nexus 5 (rev_11)).
#!/usr/bin/env python
"""
Patch a recovery image to enable RTC writing
Unfortunately it has not the intended effect (tested from recovery):
~ # /system/xbin/hwclock -w
hwclock: RTC_SET_TIME: Operation not permitted
<3>[ 25.821247] spmi_pmic_arb fc4cf000.qcom,spmi: pmic_arb_wait_for_done: transaction denied (0x5)
<3>[ 25.821338] qcom,qpnp-rtc qpnp-rtc-ee162000: SPMI write failed