Skip to content

Instantly share code, notes, and snippets.

View hamjin's full-sized avatar

hamjin hamjin

View GitHub Profile
@hamjin
hamjin / build-angie-quictls.sh
Last active January 7, 2025 02:25
Build Angie with QUICTLS
#!/bin/bash
export SSL_FEATURES="no-engine no-apps no-tests no-external-tests no-trace enable-zlib enable-zstd enable-tfo enable-weak-ssl-ciphers enable-ssl3 enable-ct enable-ktls enable-sm2 enable-sm4 enable-sm3 enable-ec_nistp_64_gcc_128 -DOPENSSL_TLS_SECURITY_LEVEL=0"
export SSL_CFLAGS="-O3 -march=haswell -mtune=haswell -mavx2 -funroll-loops -D_FORTIFY_SOURCE=2 -fPIC -pipe -flto=thin"
export SSL_LINKER_FLAGS="-fuse-ld=lld -fintegrated-as -static -ljemalloc -Wl,-z,relro,-z,now,--lto-O3,-O3,--as-needed"
## deps
# sudo apt install libatomic-ops-dev libperl-dev
apk add build-base cmake clang lld llvm pcre2-dev perl-dev zstd-dev zstd-static libatomic libatomic_ops-dev libatomic_ops-static jemalloc-static zlib-dev zlib-static linux-headers
@hamjin
hamjin / build-angie-xquic-tongsuo.sh
Last active January 5, 2025 01:10
Build Angie with Tongsuo, XQUIC, Brotli, ZSTD, Clang, LLD and ThinLTO
#!/bin/bash
export SSL_QUIC_PREFIX="$HOME/.local/babassl"
export SSL_FEATURES="--api=1.1.1 no-legacy no-tests no-external-tests no-trace no-unit-test zlib enable-weak-ssl-ciphers enable-ssl3 enable-ct enable-ktls enable-ntls enable-sm2 enable-sm4 enable-sm3 enable-optimize-chacha-choose enable-ec_nistp_64_gcc_128 enable-ec_sm2p_64_gcc_128 enable-zuc enable-bulletproofs enable-sm2_threshold enable-ec_elgamal enable-twisted_ec_elgamal enable-cert-compression -DOPENSSL_TLS_SECURITY_LEVEL=0"
export SSL_CFLAGS="-O3 -march=haswell -mtune=haswell -mavx2 -funroll-loops -D_FORTIFY_SOURCE=2 -fPIC -pipe -flto=thin"
export SSL_LINKER_FLAGS="-fuse-ld=lld -fintegrated-as -static -ljemalloc -Wl,-z,relro,-z,now,--lto-O3,-O3,--as-needed"
## deps
# sudo apt install libatomic-ops-dev libperl-dev
apk add build-base cmake clang lld llvm pcre2-dev perl-dev zstd-dev zstd-static libatomic libatomic_ops-dev libatomic_ops-static jemalloc-static zlib-dev zlib-static linux-headers
@hamjin
hamjin / align_fix.py
Created August 18, 2024 17:03
Termux alignmemt fix
#!/usr/bin/env python
import struct
import sys
import os
if len(sys.argv) < 2:
print('Usage: ' + os.path.basename(sys.argv[0]) + ' input_file')
exit()
#!/usr/bin/env python
import struct
import sys
import os
if len(sys.argv) < 2:
print('Usage: ' + os.path.basename(sys.argv[0]) + ' input_file')
exit()
@hamjin
hamjin / fast_repo_sync.sh
Last active April 29, 2024 09:02
Faster repo sync
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/kernel/manifest -b common-android12-5.10 --git-lfs --repo-url='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' --no-tags --current-branch --depth=1
repo sync -j1 --force-sync --fail-fast --no-tags --current-branch -v
@hamjin
hamjin / cloudflare-update-record.sh
Last active October 15, 2017 00:01 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="[email protected]"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="example.com"
record_name="www.example.com"
# MAYBE CHANGE THESE
ip=$(curl -s https://api-ipv4.ip.sb/ip)
@hamjin
hamjin / ddns.sh
Last active October 14, 2017 23:53 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare (API v4 compatible)
#!/usr/bin/env bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://www.cloudflare.com/a/account/my-account
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created.
# Fill in ZONE_ID and REC_ID below
# This step is optional, but will save you 2 requests every time you this script
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
haproxy.conf
============
frontend spdy
mode tcp
bind xxx.xxx.xxx.xxx:443 ssl crt /etc/haproxy/ssl.pem crt /etc/haproxy/certs.d npn spdy/3.1,http/1.1 ciphers AES256+EECDH:AES256+EDH:AES128+EDH:EECDH:!aNULL:!eNULL:!LOW:!DES:!3DES:!RC4; no-sslv3
option tcplog
log global
# route to nginx