Skip to content

Instantly share code, notes, and snippets.

@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 / install-miniconda.sh
Last active August 26, 2025 19:41
一键安装 miniconda 并配置好pip 源和 conda 源
#!/bin/bash
set -e # 出错立即退出
# 安装目录
install_dir=/opt/miniconda3
mkdir -p "$install_dir"
# 检查是否已安装
@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,)