Skip to content

Instantly share code, notes, and snippets.

View weaming's full-sized avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
  • Shenzhen, China
View GitHub Profile
@weaming
weaming / dog.py
Last active November 3, 2026 12:29
dog: alternative DNS query cli to dig
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = ["printable>=0.5.0", "dnspython>=2.8.0"]
# ///
import argparse
import ctypes
import functools
import ipaddress
@weaming
weaming / clash-verge-example.yaml
Last active November 3, 2026 12:01
clash verge DNS + TUN config example for verge + tailscale's magic dns
---
mode: rule
log-level: info
# 是否允许内核接受 IPv6 流量
# 与 dns.ipv6 是「与」关系,两者都开才会返回 AAAA
ipv6: true
# https://wiki.metacubex.one/config/dns/
# https://wiki.metacubex.one/config/dns/diagram/
#
@weaming
weaming / zte-cpe.py
Last active November 2, 2026 17:50
ZTE CPE(G5TS Pro / MC8500)命令行控制台,基于 ubus JSON-RPC
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = []
# ///
"""ZTE CPE(G5TS Pro / MC8500)命令行控制台,基于 ubus JSON-RPC。
用法:
zte-cpe status # 概览:设备 + SIM + 网络 + 信号 + 流量
zte-cpe signal --json # 信号质量,输出 JSON 供程序/AI 消费
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = []
# ///
"""解析 Codex 或 Claude 会话历史。"""
import argparse
import json
#!/usr/bin/env python3
# created at 2024.10.05
import argparse
from decimal import Decimal as D
from data_process.io_csv import read_csv, write_csv # python3 -m pip install data-process
def cal_distance(lat1, lon1, lat2, lon2):
"""
Calculate the great circle distance between two points
// ==UserScript==
// @name Shotcuts
// @namespace http://bitflow.org
// @version 0.1
// @description add shotcuts
// @match https://*/*
// @copyright 2022+, You
// ==/UserScript==
function onKey(e) {
// console.log(e, e.key);
---
# ---------------------------------------------------
# 语法 https://github.com/Dreamacro/clash/wiki/configuration
# 配置文件需要放置在 $HOME/.config/clash/config.yml
# 如果您不知道如何操作,请参阅 https://github.com/Hackl0us/SS-Rule-Snippet/wiki/clash(X)
# 由于 ClashCore 1.0 的发布,ClashX 1.30.x 的版本包括不向前兼容的更新。如果您的配置文件尚未兼容新的配置文件格式,请谨慎更新。
# 查看详细内容:https://github.com/Dreamacro/clash/wiki/breaking-changes-in-1.0.0
# ---------------------------------------------------
package main
import (
"fmt"
)
func one(n int64) {
ids := []int64{}
for i := int64(1); i <= n; i++ {
ids = append(ids, i)
#!/usr/local/bin/python
import json
import datetime
from urllib.request import urlopen
INSTANCES = [
{
# Your private key for accessing gitlab: User -> Settings -> Access tokens -> add personal access token with api scope
package main
import (
"encoding/json"
"fmt"
"strings"
)
const DASH = "-"