Skip to content

Instantly share code, notes, and snippets.

import socket
import struct
import argparse
from typing import Tuple, List
class LocalResolver:
"""本地 DNS 解析器, 显式区分 IPv4 / IPv6"""
@staticmethod
import socket
import struct
import random
import argparse
from typing import List, Tuple
class DnsQueryBuilder:
"""构造标准 DNS 查询报文"""
@nanpuyue
nanpuyue / start_thunder.sh
Last active November 2, 2025 09:19
CrossOver 迅雷极速版启动脚本,用于修复残留窗口遮挡屏幕
#!/bin/bash
# filename: start_thunder.sh
# date: 2017-03-11
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
EXIT_TIME=$(( $(date +%s) + 15 ))
exec "/opt/cxoffice/bin/wine" --bottle "迅雷极速版" --check --wait-children --start "C:/users/Public/Start Menu/Programs/迅雷软件/迅雷极速版/启动迅雷极速版.lnk" "$@" &
#!/bin/bash
# date: 2017-11-17
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
echo 'install: ~/.mozilla/native-messaging-hosts/hide_titlebar.json'
[[ -d ~/.mozilla/native-messaging-hosts ]] || mkdir -p ~/.mozilla/native-messaging-hosts
cat > ~/.mozilla/native-messaging-hosts/hide_titlebar.json << EOF
{
"name": "hide_titlebar",
@nanpuyue
nanpuyue / outbound-limit.sh
Created May 21, 2024 00:54
Set the Interface Down if Monthly Traffic Limit Exceeded
#!/bin/bash
# date: 2024-05-21
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
# 设置接口名称和流量限制
IFACE="eth0"
LIMIT="190 GiB"
# vnstat 数据库文件路径
@nanpuyue
nanpuyue / openwrt-hc5611.patch
Created January 26, 2018 15:38
Add support for HiWiFi HC5611 for OpenWrt
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 37630cde66..f90ed13d12 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -205,6 +205,9 @@ hc5661a)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "eth0.2"
set_wifi_led "$boardname:blue:wlan2g"
;;
+hc5611)
+ ucidef_set_led_default "system" "system" "$boardname:green:system" "1"
// date: 2020-01-10
// update: 2024-04-01
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
#![feature(coroutines)]
#![feature(coroutine_trait)]
use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
// date: 2020-01-10
// update: 2024-03-31
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
#![feature(coroutines)]
#![feature(coroutine_trait)]
use std::ops::{Coroutine, CoroutineState};
use std::pin::Pin;
@nanpuyue
nanpuyue / fonts-rename.sh
Last active July 1, 2023 12:48
读取字体文件内部名称并以此重命名字体文件文件。
#!/bin/bash
# 南浦月
# nanpuyue@gmail.com
# 2013-5-11
# 用法:
# fonts-rename.sh <字体目录>
# fonts-rename.sh <字体文件>
// date: 2023-06-12
// license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
// author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
// build: gcc -fPIC -shared -o hook_uname.so hook_uname.c -ldl
// usage: LD_PRELOAD=./hook_uname.so uname -a
#include <string.h>
#include <dlfcn.h>
#include <sys/utsname.h>