适用场景:将 OpenWrt / ImmortalWrt 固件写入 eMMC / SD 卡 / SSD 后,固件只占用了很小一部分空间,剩余大量空间未被使用。本教程将介绍如何不重新刷机,在系统运行中将 overlay 分区扩容至磁盘剩余空间。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import winreg | |
| import ctypes | |
| from ctypes import wintypes | |
| # ========== Win32 API 常量和结构体定义 ========== | |
| CCHDEVICENAME = 32 | |
| MONITORINFOF_PRIMARY = 0x00000001 | |
| class MONITORINFOEX(ctypes.Structure): | |
| """扩展的显示器信息结构体""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| 批量将 webm 目录下的所有 .webm 文件转换为带透明通道的 .gif | |
| 使用 libvpx-vp9 解码器正确读取 VP9 alpha 通道 | |
| 使用 palettegen/paletteuse 保留透明度 | |
| 禁用 GIF offsetting 和 transdiff 避免白色活动矩形 | |
| 准备工作: | |
| --------- | |
| 1. Python 依赖: |
通过 Cloudflare Workers 转发并签名调用
https://api.io.mi.com,简化小米 IoT 设备(米家)控制流程。
- 路径过滤:仅接受以
/app/开头的POST请求。 - 鉴权字段提取:自动从请求体中提取
userId、serviceToken、deviceId、securityToken四个字段,data字段参与签名计算。 - HMAC-SHA256 签名:按米家官方协议生成
_nonce、signedNonce及signature三个参数。 - 请求转发:将组装好的
application/x-www-form-urlencoded请求转发至https://api.io.mi.com,并将原始响应返回给调用方。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import ephem | |
| from datetime import datetime, timedelta, UTC | |
| from typing import Union, Tuple | |
| from functools import lru_cache | |
| class ChineseCalendar: | |
| """中国传统干支历法计算工具""" | |
| # 天干和地支表 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Docker Registry 代理 Worker | |
| * | |
| * 功能说明: | |
| * 1. 根路径请求重定向到 Docker 官网 | |
| * 2. 针对 /v2/ 请求返回带有 WWW-Authenticate 挑战的响应, | |
| * 引导 Docker 客户端获取认证 Token。 | |
| * 3. 针对 /auth/token 请求,从 Docker 授权服务获取认证 Token。 | |
| * 4. 对于其他请求(如拉取镜像配置或镜像数据),转发到上游 Docker Registry, | |
| * 并在必要时对请求路径进行调整(例如缺失默认命名空间时自动补全 "library")。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| # 定义用户代理,用于模拟浏览器的请求头 | |
| USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36" | |
| # 定义登录和注销的URL | |
| LOGIN_URL = "http://192.168.1.1/boaform/admin/formLogin" | |
| LOGOUT_URL = "http://192.168.1.1/boaform/admin/formLogout" | |
| # 遍历尝试的密码,从0到9999 |