Skip to content

Instantly share code, notes, and snippets.

@ted423
ted423 / dockersave.sh
Created September 15, 2026 03:56
dockersave
#!/bin/bash
# 用法: ./dockersave.sh <镜像名[:tag]>
# 例如: ./dockersave.sh myapp:1.0
# ./dockersave.sh registry.example.com/group/myapp:1.0
# 说明: 先尝试 pull,pull 失败不中断(本地编译的镜像本来就不在远端仓库里),
# 只要本地存在该镜像就继续保存为 <镜像名>_<tag>.tar.gz
set -o pipefail
image="$1"
@ted423
ted423 / Dockerfile
Created November 18, 2025 07:39
novnc ubuntu dockerfile
FROM ubuntu:24.04
RUN apt update && apt -y upgrade && apt install -q -y tzdata ca-certificates software-properties-common curl && apt clean -y
RUN sed -i "s|http://|https://|g" /etc/apt/sources.list.d/ubuntu.sources
RUN apt update && apt -y upgrade && \
apt install -q -y tzdata novnc && apt clean -y
@ted423
ted423 / disBitlocker.bat
Created November 4, 2025 06:35
disBitlocker.bat
@echo off
setlocal enabledelayedexpansion
REM 遍历所有可能的盘符
for %%D in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
REM 检查盘符是否存在
if exist %%D:\ (
echo -------------------------------
echo [%date% %time%] 检查 %%D:\
@ted423
ted423 / getPCmonitorSN.bat
Created November 4, 2025 06:34
getPCmonitorSN.bat
@echo off
setlocal enabledelayedexpansion
chcp 65001 >nul
REM bat default is ANSI(gbk) set to utf-8
echo 脚本很可能需要管理员权限才能获取显示器SN
where pwsh >nul 2>nul
if %errorlevel% equ 0 (
echo "use PowerShell 7(pwsh)"
@ted423
ted423 / tarxz.sh
Last active January 24, 2026 16:10
tarxz.sh
#!/bin/bash
# 1.2
# 中间可以加的参数 --exclude='pattern'
if [ "$#" -gt 0 ]; then
# 获取最后一个参数,参数放在前面,要打包的路径放在最后
allarg="$*"
last_arg="${!#}"
if [[ "$last_arg" == "." || "$last_arg" == ".." ]]; then
echo "请勿打包 . .. 目录,会导致产生的压缩文件被打包,造成问题"
exit 1