Skip to content

Instantly share code, notes, and snippets.

View ipid's full-sized avatar
Busily Occupied

ipid ipid

Busily Occupied
View GitHub Profile
ipid / revert-karaoke.lua
Last active April 21, 2023 15:16
Aegisub Lua 自动化脚本「还原卡拉 OK 特效」,用于将字幕恢复到应用卡拉 OK 模板前的状态。
View revert-karaoke.lua
script_name = '还原卡拉 OK 特效'
script_description = '将字幕恢复到应用卡拉 OK 模板前的状态。'
script_author = 'ipid君 <>'
script_version = '1.0'
--[[ 判断 text 是否以 suffix 为结尾 ]]
local function endsWith(text, suffix)
return text:sub(-#suffix) == suffix
ipid /
Created March 1, 2023 04:25
处理从 niconico 抓包获取的 .ts 分片文件。
from pathlib import Path
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--root', type=Path, default='.')
parser.add_argument('--ext', type=str, default='.ts')
parser.add_argument('--record', '--archive', '--recording', action='store_true', default=False)
parser.add_argument('--out-m3u8', type=Path, default=Path('./list.m3u8'))
args = parser.parse_args()
ipid / eplus-downloader.mjs
Last active August 13, 2023 09:06
一个生成 eplus 下载列表和 M3U8 的帮助脚本。
View eplus-downloader.mjs
使用如下的 aria2 命令行来下载 list.txt 即可:
aria2c --all-proxy --header="cookie: CloudFront-Key-Pair-Id=OVUEIDT7LTF98UIWPOEZ; CloudFront-Policy=A3JTdGF0TcxffroJKiuiuhoyJnbvT9BYU90juitdfjNibVCf5t678ominh89X19XX9; CloudFront-Signature=Uvoe9cjwf9vn00239n8c83398rfn89w8vne048hgn0revm09e4thg8nvmrp0_; MEMBER_ID=2efce3471928379323r2cew3rfdz; TODOFUKEN_CODE=114514" --input-file=list.txt --max-concurrent-downloads=16 --max-connection-per-server=16 --keep-unfinished-download-result=false --auto-file-renaming=false
然后使用如下的 ffmpeg 命令行来合并 .ts 分片:
ffmpeg -i list.m3u8 -c copy -movflags +faststart out.mp4
ipid /
Last active January 29, 2023 08:17
A closeable Python asyncio queue implementation.
import asyncio
from asyncio import Future
from collections import deque, namedtuple
QueueGetResult = namedtuple('QueueGetResult', ['item', 'isOpening'])
class CloseableQueue:
def __init__(self):
# 当前正在等待结果的协程的 Future
ipid /
Last active January 23, 2023 11:32
A simple Bash script that cross-compile Go code to all supported platform, generate zips and print checksums. Originally wrote for ytarchive.
export CGO_ENABLED=0
if [[ -n "$1" ]]; then
LDFLAGS="-X main.Commit=-$(git rev-parse --short HEAD)"
go mod download & rm -f build/*.zip & readarray -t goSupported <<< "$(go tool dist list)"
ipid /
Created December 13, 2022 13:39
import sys
from pathlib import Path
from argparse import ArgumentParser
from dataclasses import dataclass
class Arguments:
upper: bool
separator: str
ipid / gmssl-cert-verify.cpp
Last active December 6, 2022 18:21
使用 GmSSL v3.0.0 验证国密证书签名合法性,并显示证书、证书签名非法原因。
View gmssl-cert-verify.cpp
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <cstdint>
#include <iostream>
#include <memory>
#include <gmssl/oid.h>
#include <gmssl/sm2.h>
ipid / 反防复制 + 反监控页面切换.user.js
Created October 17, 2022 04:41
View 反防复制 + 反监控页面切换.user.js
// ==UserScript==
// @name 反防复制 + 反监控页面切换
// @namespace
// @version 0.1
// @description 用于绕过复制限制的用户脚本。
// @author ipid
// @include *
// @grant none
// @run-at document-start
// ==/UserScript==
ipid / swas.wg0.server.conf
Created August 19, 2022 11:15
Wireguard DMZ 示例,一条命令让你轻松拥有公网地址。An example of Wireguard DMZ configuration that provides you a public IPv4 address.
View swas.wg0.server.conf
Address =
PrivateKey = ******************************************
ListenPort = 51000
PostUp = iptables -t nat -F; iptables -t nat -A PREROUTING -p tcp -m multiport --dports 1024:50999,51001:65534 -i eth0 -j DNAT --to-destination; iptables -t nat -A PREROUTING -p udp -m multiport --dports 1024:50999,51001:65534 -i eth0 -j DNAT --to-destination; iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE
PostDown = iptables -t nat -F
AllowedIPs =
ipid / dblp 按条件隐藏论文.user.js
Last active October 17, 2022 04:42
隐藏只命中作者的论文,隐藏非 CCF A、CCF B 的论文
View dblp 按条件隐藏论文.user.js
// ==UserScript==
// @name dblp 按条件隐藏论文
// @namespace
// @version 0.1
// @description 隐藏只命中作者的论文,隐藏非 CCF A、CCF B 的论文
// @author ipid
// @match *://*
// @match *://**
// @match *://*
// @match *://**