Skip to content

Instantly share code, notes, and snippets.

View t0saki's full-sized avatar

Zhengxiao Wu t0saki

  • National University of Singapore
  • Singapore
  • 22:04 (UTC +08:00)
View GitHub Profile
@t0saki
t0saki / monitor_incusd.sh
Last active March 29, 2025 16:48
incused monitor
#!/bin/bash
# 脚本文件:/root/monitor_incusd_top.sh
# 功能:每分钟检查incusd进程的CPU占用率(使用top采样),如果连续3分钟超过80%,则重启服务
LOG_FILE="/root/incusd_monitor.log"
COUNTER_FILE="/tmp/incusd_high_cpu_counter"
if [ ! -f "$COUNTER_FILE" ]; then
echo "0" > "$COUNTER_FILE"
fi
@t0saki
t0saki / xyz-chooser.py
Last active March 26, 2025 09:04
选择xyz域名
from tqdm import tqdm
def score_number(num_str):
"""
对6位数字字符串进行评分
1. 相邻重复位数每遇到相邻相同的数字得分为重复个数的平方
2. 数字689每出现一个加0.5
3. 不同数字数量奖励为 6 - (不同数字的数量),乘以0.5