Compare commits

..

10 Commits

Author SHA1 Message Date
luk
5920cde656 u 2026-02-01 19:17:14 +08:00
luk
f01868e246 u 2026-02-01 19:12:37 +08:00
root
dcb621ef20 add tailscale scripts 2026-01-31 00:21:06 +08:00
root
c5e6fdcbf5 add tailscale scripts 2026-01-31 00:17:02 +08:00
Luk
044bd6c8a3 u 2026-01-28 14:02:59 +08:00
Luk
a1d9d2a76f u 2026-01-28 13:02:05 +08:00
Luk
cc6789a9cc u 2026-01-27 21:32:50 +08:00
Luk
c8ef431ae3 u 2026-01-27 09:58:55 +08:00
Luk
d56cc243c1 u 2026-01-27 09:56:09 +08:00
Luk
002a4ccf5b u 2026-01-26 19:13:31 +08:00
38 changed files with 164 additions and 59 deletions

0
acme-install.sh Normal file → Executable file
View File

0
acme-setup.sh Normal file → Executable file
View File

0
acme-uninstall.sh Normal file → Executable file
View File

0
caddy-install.sh Normal file → Executable file
View File

0
conda-init.sh Normal file → Executable file
View File

0
conda-install.sh Normal file → Executable file
View File

0
temp-detect.sh → detect-disk-temperature.sh Normal file → Executable file
View File

0
docker-install-debian.sh Normal file → Executable file
View File

0
docker-install-ubuntu.sh Normal file → Executable file
View File

0
find-and-run-recursively.sh Normal file → Executable file
View File

View File

@@ -24,17 +24,17 @@ if not exist "%ROOTPATH%" (
)
echo ::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]
set /p IGNOREPATH=">>> "
set /p GLOBALPATH=">>> "
echo;
if "" == "%IGNOREPATH%" (
set IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
if "" == "%GLOBALPATH%" (
set GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
) else (
for %P in (%IGNOREPATH%) do set "IGNOREPATH=%~dpnxP/.gitignore_global"
if not exist "%IGNOREPATH%" (
echo ××× [[%IGNOREPATH%]] not exist! Exit now. ***
for %P in (%GLOBALPATH%) do set "GLOBALPATH=%~dpnxP/.gitignore_global"
if not exist "%GLOBALPATH%" (
echo ××× [[%GLOBALPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ IGNOREPATH = [[%IGNOREPATH%]]
echo √√√ GLOBALPATH = [[%GLOBALPATH%]]
)
)
@@ -48,7 +48,7 @@ for /d /r %%r in (*) do (
if exist "%%r\.git" (
pushd "%%r"
echo ---- updating .gitignore in [[%%r]] ----
cat %IGNOREPATH%\.gitignore %%r\.gitignore.local.txt > %%r\.gitignore
cat %GLOBALPATH%\.gitignore %%r\.gitignore.local.txt > %%r\.gitignore
echo;
popd
)

24
git-ignore-find2merge.sh Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/bin/bash
echo ""
echo "Search in [ROOTPATH], merge [IGNOREPATH/.gitignore_global] and [ROOTPATH/*/.gitignore.local.txt] files to [seafile-ignore.txt]"
echo "Search in [ROOTPATH], merge [GLOBALPATH/.gitignore_global] and [ROOTPATH/*/.gitignore.local.txt] files to .gitignore"
echo ""
if [ -d "$1" ]
@@ -27,22 +27,22 @@ fi
echo ""
echo "::*** Enter [path to .gitignore_global] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global]]"
read -p "***:: " IGNOREPATH
if [ "$IGNOREPATH" ]
read -p "***:: " GLOBALPATH
if [ "$GLOBALPATH" ]
then
if [ -d "$IGNOREPATH" ]
if [ -d "$GLOBALPATH" ]
then
IGNOREPATH=$(realpath $IGNOREPATH)/.gitignore_global
GLOBALPATH=$(realpath $GLOBALPATH)/.gitignore_global
fi
if [ ! -f "$IGNOREPATH" ]
if [ ! -f "$GLOBALPATH" ]
then
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
echo "××× Not found [[$GLOBALPATH]]. Exit now..."
exit
else
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
fi
else
IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/.gitignore_global
fi
echo ""
@@ -62,11 +62,11 @@ do
if [ -f "$repo/.gitignore" ] # some git repo need to keep privacy, therefore judge from .gitignore, not from .git
then
echo "---- updating [[$repo/.gitignore]] ----"
if [ -f "$IGNOREPATH" ]
if [ -f "$GLOBALPATH" ]
then
cat $IGNOREPATH > $repo/.gitignore
cat $GLOBALPATH > $repo/.gitignore
else
curl -sSL $IGNOREPATH | cat > $repo/.gitignore
curl -sSL $GLOBALPATH | cat > $repo/.gitignore
fi
cat $repo/.gitignore.local.txt 2>/dev/null >> $repo/.gitignore
echo ""

View File

@@ -1 +0,0 @@
echo `hostname -I` | awk '{print $1;}'

0
mac-accelerate-backup.sh Normal file → Executable file
View File

0
mac-autohide-dock.sh Normal file → Executable file
View File

0
mac-brew-apps.sh Normal file → Executable file
View File

0
mac-brew-install.sh Normal file → Executable file
View File

0
mac-brew-mirror.sh Normal file → Executable file
View File

0
mac-create-vdisk.sh Normal file → Executable file
View File

0
mac-disable-store-files.sh Normal file → Executable file
View File

0
mac-remove-launchpad-icons.sh Normal file → Executable file
View File

0
mac-resize-launchpad.sh Normal file → Executable file
View File

4
myip.sh Executable file
View File

@@ -0,0 +1,4 @@
echo Local IP: $(echo `hostname -I` | awk '{print $1;}')
echo Public IP: `curl -s ifconfig.me`
echo

View File

@@ -74,23 +74,22 @@ if [ -d "$HomePath" ]; then
read -p "***:: " AuthorizedKeys
if [ "$AuthorizedKeys" = 'l' ]; then
if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]; then
mv "$HomePath/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
fi
echo "--- Linking [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
ln -s "$NIXHOME/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys"
sudo chmod 644 "$HomePath/.ssh/authorized_keys" # 确保其他用户能读取 nixhome/.ssh/authorized_keys
elif [ "$AuthorizedKeys" = 'a' ]; then
if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]; then
mv "$HomePath/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
fi
echo "--- Copying [[$NIXHOME/authorized_keys]] to [[$HomePath/.ssh/authorized_keys]] ..."
cat "$NIXHOME/.ssh/authorized_keys" >> "$HomePath/.ssh/authorized_keys"
chmod 600 "$HomePath/.ssh/authorized_keys"
else
exit 0
fi
echo
if [ -f "$HomePath/.ssh/authorized_keys" ] || [ -L "$HomePath/.ssh/authorized_keys" ]; then
mv "$HomePath/.ssh/authorized_keys" "$HomePath/.ssh/authorized_keys.backup-$(date -u +%Y%m%dT%H%M%Sutc)"
fi
fi
popd

View File

@@ -124,29 +124,36 @@ esac
# - `7`: White
# others:
# \w shows absolute path, \W shows current folder.
if [ "$(uname)" = "Darwin" ]; then
MYOSVERSION=Mac`sw_vers -productVersion`
elif [ -f /etc/debian_version ]; then
MYOSVERSION=Deb`cat /etc/debian_version 2>/dev/null`
elif [ -f /etc/ubuntu_version ]; then
MYOSVERSION=Ubt`cat /etc/ubuntu_version 2>/dev/null`
fi
if [[ -n "$SSH_CONNECTION" ]]; then
IN_SSH="[ssh]"
fi
if [ "$color_prompt" = yes ]; then
PS1='[\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h=$(uname)=$(uname -m)\[\033[00m\]::\[\033[07;34m\]\w\[\033[00m\]] '
PS1='<\[\033[07;32m\]\t\[\033[00m\]#\[\033[07;35m\]\u\[\033[00m\]@\[\033[07;31m\]\h\[\033[00m\]^\[\033[07;34m\]$(uname -m),$(uname),$MYOSVERSION\[\033[00m\]:$IN_SSH:\[\033[07;36m\]\w\[\033[00m\]> '
else
PS1='[\t#\u@\h($(uname)-$(uname -m)):\w] ' # \w shows absolute path, \W shows current folder.
PS1='<\t#\u@\h^$(uname -m),$(uname),$MYOSVERSION:$IN_SSH:\w> ' # \w shows absolute path, \W shows current folder.
fi
unset color_prompt force_color_prompt
############## above settings copied from amazon's debian ####################
if [ "$(uname)" = "Darwin" ]
then
if [ "$(uname -m)" = "arm64" ] && [ -f /opt/homebrew/bin/brew ]
then
if [ "$(uname)" = "Darwin" ]; then
if [ "$(uname -m)" = "arm64" ] && [ -f /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ "$(uname -m)" = "x86_64" ] && [ -f /usr/local/homebrew/bin/brew ]
then
elif [ "$(uname -m)" = "x86_64" ] && [ -f /usr/local/homebrew/bin/brew ]; then
eval "$(echo $(/usr/local/homebrew/bin/brew shellenv) | sed 's#HOMEBREW_CELLAR=.*$#HOMEBREW_CELLAR=/usr/local/Cellar#')"
fi
fi
# nvm settings
if [ -d $HOME/.nvm ]
then
if [ -d $HOME/.nvm ]; then
# 注意,这句 export 导致 `su` 会继承原用户的环境变量 NVM_DIR=/home/原用户/.nvm可能导致不符合预期的行为。因此要 `su -` 更安全。
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

View File

@@ -22,10 +22,15 @@
*.nosf/
*.nosf.*/
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
FETCH_HEAD
*/FETCH_HEAD
.Trash/
.DS_Store
*/.DS_Store
*.aae # AAE 文件主要在苹果的照片应用程序中使用,保存对原始照片所做的编辑,比如,裁剪、旋转或调整亮度等操作的信息。
.thumbnails
*/.thumbnails
@@ -50,14 +55,17 @@ _desktop.ini
node_modules/
*/node_modules/
package-lock.json
*/package-lock.json
pages4loader.json5
*/pages4loader.json5
.deploy_git/
*/.deploy_git/
# next.js 项目
.next/
*/.next/
# HBuilder 目录
unpackage/

0
nodejs-remove.sh Normal file → Executable file
View File

0
npm-registry.sh Normal file → Executable file
View File

0
rclone-starter.sh Normal file → Executable file
View File

28
seafile-ignore-find2merge.sh Normal file → Executable file
View File

@@ -1,7 +1,7 @@
#!/bin/bash
echo ""
echo "Search in [ROOTPATH], Merge [IGNOREPATH/seafile-ignore.global.txt] and [ROOTPATH/*/seafile-ignore.local.txt] files to [seafile-ignore.txt]"
echo "Search in [ROOTPATH], Merge [GLOBALPATH/seafile-ignore.global.txt] and [ROOTPATH/*/seafile-ignore.local.txt] files to [seafile-ignore.txt]"
echo ""
if [ -d "$1" ]
@@ -27,22 +27,22 @@ fi
echo ""
echo "::*** Enter [path to seafile-ignore.global.txt] or [leave blank] for default [[https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt]]"
read -p "***:: " IGNOREPATH
if [ "$IGNOREPATH" ]
read -p "***:: " GLOBALPATH
if [ "$GLOBALPATH" ]
then
if [ -d "$IGNOREPATH" ]
if [ -d "$GLOBALPATH" ]
then
IGNOREPATH=$(realpath $IGNOREPATH)/seafile-ignore.global.txt
GLOBALPATH=$(realpath $GLOBALPATH)/seafile-ignore.global.txt
fi
if [ ! -f "$IGNOREPATH" ]
if [ ! -f "$GLOBALPATH" ]
then
echo "××× Not found [[$IGNOREPATH]]. Exit now..."
echo "××× Not found [[$GLOBALPATH]]. Exit now..."
exit
else
echo "√√√ IGNOREPATH = [[$IGNOREPATH]]"
echo "√√√ GLOBALPATH = [[$GLOBALPATH]]"
fi
else
IGNOREPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
GLOBALPATH=https://git.tic.cc/npm/sysconfig/raw/branch/main/nixhome/seafile-ignore.global.txt
fi
echo ""
@@ -57,16 +57,16 @@ cd $ROOTPATH
echo "*** Starting from [[`pwd`]] ***"
echo ""
find . -mindepth 1 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
find . -mindepth 0 -maxdepth 3 -type d -name '[^.]*' | grep -E -v 'node_modules|uni_modules|\.deploy_git|\.git|.svn|\.vscode|\.wrangler|unpackage|_webroot|_logstore|_datasotre|_archive|_filestore|_ssl' | while read repo
do
if [ -f "$repo/seafile-ignore.txt" ]
if [ -f "$repo/seafile-ignore.txt" ] || [ -d "$repo/.git" ]
then
echo "---- updating [[$repo/seafile-ignore.txt]] ----"
if [ -f "$IGNOREPATH" ]
if [ -f "$GLOBALPATH" ]
then
cat $IGNOREPATH > $repo/seafile-ignore.txt
cat $GLOBALPATH > $repo/seafile-ignore.txt
else
curl -sSL $IGNOREPATH | cat > $repo/seafile-ignore.txt
curl -sSL $GLOBALPATH | cat > $repo/seafile-ignore.txt
fi
cat $repo/seafile-ignore.local.txt 2>/dev/null >> $repo/seafile-ignore.txt
echo ""

0
seafile-ignore-merge-here.sh Normal file → Executable file
View File

84
seafile-ignore.txt Normal file
View File

@@ -0,0 +1,84 @@
# https://help.seafile.com/syncing_client/excluding_files/
# 注释。通配符:* 匹配0到若干个字符包括代表目录的/。? 匹配1个字符包括/。
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
# 在这种情况下,
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
### seafile-ignore.global.txt ###
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
*.sfignore
*.sfignore/
*.sfignore.*
*.sfignore.*/
*.sfomit
*.sfomit.*
*.sfomit/
*.sfomit.*/
*.nosf
*.nosf.*
*.nosf/
*.nosf.*/
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
FETCH_HEAD
*/FETCH_HEAD
.Trash/
.DS_Store
*/.DS_Store
.thumbnails
*/.thumbnails
Thumbs.db
*/Thumbs.db
thumbs.db
*/thumbs.db
_desktop.ini
*/_desktop.ini
._*
*/._*
.$*
*/.$*
~$*
*/~$*
node_modules/
*/node_modules/
package-lock.json
*/package-lock.json
pages4loader.json5
*/pages4loader.json5
.deploy_git/
*/.deploy_git/
# next.js 项目
.next/
*/.next/
# HBuilder 目录
unpackage/
*/unpackage/
Icon
OneDrive/Icon
# wrangler project
.dev.vars*
*/.dev.vars*
.wrangler/
*/.wrangler/
### seafile-ignore.local.txt ###

14
ssh.sh Normal file → Executable file
View File

@@ -66,18 +66,18 @@ then
port=22
fi
echo "::*** Coonecting to ${label}"
echo "::*** Connecting to ${label}"
if [ "$password" != "null" ]
then
if [ "$(which sshpass)" ]
then
echo "::*** sshpass -p $password -X -p $port $username@$host"
sshpass -p $password ssh -X -p $port "$username@$host" $2
echo "::*** sshpass -p $password -Y -p $port $username@$host"
sshpass -p $password ssh -Y -p $port "$username@$host" $2
else
echo "::*** ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2
echo "::*** ssh -Y -p $port $username@$host"
ssh -Y -p $port "$username@$host" $2 # -X 在 linux 安装 xrdp 后连接时报错,改 -Y 就可。
fi
else
echo "::*** ssh -X -p $port $username@$host"
ssh -X -p $port "$username@$host" $2
echo "::*** ssh -Y -p $port $username@$host"
ssh -Y -p $port "$username@$host" $2
fi

0
svn-serve.sh Normal file → Executable file
View File

1
ts-run-as-exit.sh Executable file
View File

@@ -0,0 +1 @@
sudo tailscale up --advertise-exit-node

1
ts-set-exit.sh Executable file
View File

@@ -0,0 +1 @@
sudo tailscale set --exit-node=de2 --exit-node-allow-lan-access=true

2
ts-unset-exit.sh Executable file
View File

@@ -0,0 +1,2 @@
sudo tailscale set --exit-node=