Skip to content

Instantly share code, notes, and snippets.

View knight42's full-sized avatar
❤️
Loving @FogDong

Zack Zeng knight42

❤️
Loving @FogDong
View GitHub Profile
@knight42
knight42 / test.sgmodule
Last active December 14, 2025 06:52
test.sgmodule
#!name=测试(2025年12月14日更新)
#! \\ You Can Change The World With Code.
#!配置教程: https://limbopro.com/archives/12904.html
#!电报群组: https://t.me/Adblock4limbo
#!源码仓库: https://github.com/limbopro/Adblock4limbo
#!许可说明: https://github.com/limbopro/Adblock4limbo/blob/main/LICENSE
#!提交反馈: https://github.com/limbopro/Adblock4limbo/issues
#! // Done Is Better Than Perfect.
@knight42
knight42 / mobile-unlock-bilibili.sgmodule
Last active November 18, 2025 22:34
Surge/Shadowrocket modules
#!name=解锁移动端B站视频的地区限制
#!date = 2025-11-16 00:00:00
#!version = 0.0.2
[Rule]
# 以下规则只对网页端有效
# DOMAIN,www.bilibili.com,HK
DOMAIN,httpdns.bilivideo.com,HK,pre-matching
DOMAIN,grpc.biliapi.net,HK,pre-matching
@knight42
knight42 / forwarder.go
Created April 3, 2024 08:35
tcp forwarder that will retry upon connection refused error
package main
import (
"errors"
"flag"
"fmt"
"io"
"log/slog"
"net"
"os"
@knight42
knight42 / ci-check-pr-title-format.py
Created April 24, 2023 08:55 — forked from rexwangcc/ci-check-pr-title-format.py
A Python Script for checking Pull Request title conventions.
import sys
import re
from typing import Callable, List
VALID_PR_TAGS = {
# this pr implements new features
"Feature",
# this pr fixes bugs
"Bugfix",
# this pr updates documentation
@knight42
knight42 / compare_oss_cdn.py
Created November 3, 2022 03:29
比较阿里云 OSS 于 CDN 价格
#!/usr/bin/env python -O
def compare_price(requests_count: int, cdn_hit_ratio: float, obj_size_kb: int):
cdn_traffic_per_gb_price = 0.24
cdn_https_requests_per_10_thousand_price = 0.05
cdn_back_to_origin_traffic_per_gb = 0.15
oss_traffic_per_gb_price = 0.5
oss_get_per_10_thousand_price = 0.01
@knight42
knight42 / envoy-config.yml
Created September 16, 2022 10:17
Envoy ext_auth demo
static_resources:
listeners:
- name: listener_0
address:
socket_address:
protocol: TCP
address: 127.0.0.1
port_value: 3000
filter_chains:
- filters:
@knight42
knight42 / go.mod
Created May 15, 2022 14:47
Connect to the buildkitd embeded in dockerd
module q
go 1.18
replace github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220224222438-c78f6963a1c0+incompatible
require (
github.com/containerd/console v1.0.3
github.com/docker/docker v20.10.7+incompatible
github.com/moby/buildkit v0.10.3
@knight42
knight42 / main.go
Last active September 14, 2020 05:45
scan non-synced shared informer factory in k8s unit tests
package main
import (
"bufio"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
)
package main
import (
"bytes"
"context"
"fmt"
"io"
"log"
"net"
"strconv"

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?