Skip to content

Instantly share code, notes, and snippets.

@zombie110year
zombie110year / gen_config.py
Created December 4, 2020 10:09
解析 SSR 订阅链接,输出 shadowsocks-rust 的配置文件
import requests as r
from base64 import urlsafe_b64decode as b64decode
from typing import List, Optional
import json
订阅服务器 = "*"
def query(url: str) -> Optional[str]:
resp = r.get(url, timeout=30)
if resp.status_code == 200:
@zombie110year
zombie110year / numtext.c
Created April 21, 2022 13:46
convert number to its english presentation.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned long number_t;
const char *SMALL_NUMBERS[] = {"zero", "one", "two", "three",
"four", "five", "six", "seven",
"eight", "nine", "ten", "eleven",
"twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen"};
@zombie110year
zombie110year / mapnames.toml
Last active May 12, 2026 22:16
Lookup table for Left 4 Dead 2 maps (official and a part of unofficial).
# Unofficial
[[mapnames]]
name_zh = "2019 II:Metal Gear Blart"
name = "2019 II:合金装备"
maps = [
"2019ii_fourth_plaza",
"2019ii_fourth_streets",
"2019ii_blart_battle",
"2019ii_fourth_outside",
"2019ii_fourth_getup",
@zombie110year
zombie110year / async_runner.py
Created April 27, 2023 01:05
在异步代码中向 Runner 中添加任务,其保证按添加顺序执行
import asyncio
import logging
from asyncio import Queue
from dataclasses import dataclass
from random import randint
from uuid import UUID, uuid4
from sys import stdout
logging.basicConfig(level=logging.DEBUG, filename="main.log")
@zombie110year
zombie110year / officex.py
Last active June 2, 2023 08:23
这个脚本可以把指定目录下的 doc、xls、ppt 文件转换成 docx、xlsx、pptx格式。用法可阅读 parser 的参数。使用时不会检查文件锁定,但不会修改原文件,且会弹出Office应用窗口,可以手动关闭对应程序。
import logging
from argparse import ArgumentParser
from pathlib import Path
from sys import exit
from win32com.client import Dispatch, CDispatch
logging.basicConfig(level="INFO")
@zombie110year
zombie110year / main.rs
Last active August 6, 2023 03:13
立刻关闭显示器并锁屏,一个 Rust 调用 Windows API 的小工具。
//! ```toml
//! # cargo.toml
//! [package]
//! name = "screenoff"
//! version = "0.1.0"
//! edition = "2021"
//! description = "通过 Windows API 关闭电脑显示屏"
//! # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
//!
//! [dependencies]
@zombie110year
zombie110year / splitmap.py
Created March 11, 2024 07:12
把求生之路三方图拆分成两部分,一部分包含地图本体,另一部分包含材质,方便服务器、客户端两用。
# 将地图文件拆分成两份(vtf 或 非 vtf)
# 地图文件需要提前解包并重命名
# 依赖工具:
# 1. https://github.com/ValvePython/vpk vpk 解包
# 2. Left 4 Dead 2 Authoring Tools vpk.exe 打包
from argparse import ArgumentParser
from pathlib import Path
from subprocess import run
from vpk import open as open_vpk