Skip to content

Instantly share code, notes, and snippets.

@xx025
xx025 / esaytire-web.sh
Last active May 25, 2026 12:16
esaytire-web
#!/usr/bin/env bash
set -euo pipefail
SELF_URL="${EASYTIER_SELF_URL:-https://xget.xi-xu.me/gist/xx025/bddd2aaac268f302651329cd88505fdd/raw/ddb9b0fb2ce63c07372c056e6d007de28572f22b/esaytire-web.sh}"
if [[ "${EUID}" -ne 0 ]]; then
if [[ -f "$0" ]]; then
exec sudo -E bash "$0" "$@"
fi
#!/usr/bin/env bash
set -euo pipefail
P12_FILE="${1:-}"
P12_PASSWORD="${2:-changeit}"
OUTPUT_PREFIX="${3:-}"
if [[ -z "${P12_FILE}" ]]; then
mapfile -t P12_FILES < <(find . -maxdepth 1 -type f \( -name "*.p12" -o -name "*.P12" \) | sort)
if [[ "${#P12_FILES[@]}" -eq 0 ]]; then
@xx025
xx025 / install-syncthing.sh
Last active January 31, 2026 09:59
安装syncthing
#!/usr/bin/env bash
# 安装 Syncthing 并可选配置指定用户的 systemd 服务及 Web UI 监听地址
# 用法: sudo ./install-syncthing.sh [--user USER]
set -e
USER_NAME=""
while [[ $# -gt 0 ]]; do
case "$1" in
@xx025
xx025 / enable_gpu_persistence.sh
Last active August 28, 2025 12:05
一键开启NVIDIA GPU 驱动持久化
#!/bin/bash
# 一键创建 systemd 服务开启 NVIDIA GPU 持久模式
SERVICE_FILE="/etc/systemd/system/nvidia-persistence.service"
# 检查是否 root
if [ "$EUID" -ne 0 ]; then
echo "请用 root 权限运行此脚本"
exit 1
fi
@xx025
xx025 / init_lmod.sh
Last active April 8, 2026 08:28
install scripts, miniconda, nodejs, munge
#!/usr/bin/env bash
set -euo pipefail
# ===== 可按需修改 =====
LMOD_ROOT="/shared/apps/lmod/lmod"
MODULE_ROOT="/shared/apps/modulefiles/Core"
# Ubuntu/Debian 运行依赖
APT_PKGS=(
lua5.3
@xx025
xx025 / python_hook.py
Last active August 25, 2024 07:30
python hook
import types
from collections import namedtuple
from itertools import chain
from typing import Literal, Union
def process_result(result):
if not isinstance(result, tuple):
return (result,)