Last active 6 months ago

uk's Avatar uk revised this gist 6 months ago. Go to revision

1 file changed, 3 insertions, 1 deletion

install_ohmyzsh.sh

@@ -23,6 +23,8 @@ git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git
23 23 REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh ohmyzsh/tools/install.sh && rm -rf ohmyzsh
24 24
25 25 ZSH=$HOME/.oh-my-zsh
26 + PROXY=https://pp.ukto.top
27 +
26 28 # install zsh-syntax-highlighting
27 29 # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
28 30 git clone https://mirrors.nju.edu.cn/git/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
@@ -35,7 +37,7 @@ git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plu
35 37
36 38 # install zsh-you-should-use
37 39 # git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use
38 - git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH/custom/plugins/you-should-use
40 + git clone $PROXY/https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH/custom/plugins/you-should-use
39 41
40 42 # replace plugins and theme
41 43 cp $HOME/.zshrc $HOME/.zshrc.bak

uk's Avatar uk revised this gist 6 months ago. Go to revision

1 file changed, 5 insertions, 1 deletion

install_ohmyzsh.sh

@@ -33,9 +33,13 @@ git clone https://mirrors.nju.edu.cn/git/zsh-syntax-highlighting.git $ZSH/custom
33 33 git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plugins/zsh-autosuggestions
34 34 # echo "source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
35 35
36 + # install zsh-you-should-use
37 + # git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use
38 + git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH/custom/plugins/you-should-use
39 +
36 40 # replace plugins and theme
37 41 cp $HOME/.zshrc $HOME/.zshrc.bak
38 - zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo'
42 + zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo you-should-use'
39 43 zsh -c 'source ~/.zshrc && omz theme set ys'
40 44 # sed -i 's/(git/(git zsh-syntax-highlighting zsh-autosuggestions sudo/g' ~/.zshrc
41 45 # sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc

uk's Avatar uk revised this gist 7 months ago. Go to revision

1 file changed, 1 insertion, 1 deletion

install_vmtools.sh

@@ -2,7 +2,7 @@
2 2 set -e
3 3
4 4 # Define variables
5 - ISO_FILENAME="SMTX_VMTOOLS-3.2.2-2505290843.iso"
5 + ISO_FILENAME="SMTX_VMTOOLS-4.0.0-2506271023.iso"
6 6 ISO_FILE="/tmp/${ISO_FILENAME}"
7 7 MOUNT_POINT="/mnt/wuke-vmtools"
8 8

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 45 insertions

set-docker-prosy.sh(file created)

@@ -0,0 +1,45 @@
1 + #!/bin/bash
2 +
3 + # 获取默认网关地址
4 + GATEWAY=$(ip route | awk '/default/ {print $3}' | uniq | head -n 1)
5 +
6 + # 创建配置目录
7 + sudo mkdir -p /etc/systemd/system/docker.service.d
8 +
9 + # 根据默认网关设置对应的代理地址
10 + case "$GATEWAY" in
11 + 192.168.48.1)
12 + PROXY="http://192.168.48.48:7891"
13 + ;;
14 + 172.29.48.1)
15 + PROXY="http://172.29.48.3:7891"
16 + ;;
17 + 172.29.16.1)
18 + PROXY="http://172.29.16.3:7891"
19 + ;;
20 + 172.29.80.1)
21 + PROXY="http://172.29.80.3:7891"
22 + ;;
23 + 172.29.112.1)
24 + PROXY="http://172.29.112.3:7891"
25 + ;;
26 + *)
27 + echo "未识别的默认网关: $GATEWAY"
28 + exit 1
29 + ;;
30 + esac
31 +
32 + # 写入 docker 的代理配置
33 + sudo bash -c "cat << UK > /etc/systemd/system/docker.service.d/http-proxy.conf
34 + [Service]
35 + Environment=\"HTTP_PROXY=$PROXY\"
36 + Environment=\"HTTPS_PROXY=$PROXY\"
37 + Environment=\"NO_PROXY=localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,10.0.0.0/8,172.29.0.0/16,localhost,registry.smtx.io\"
38 + UK"
39 +
40 + # 应用更改
41 + sudo systemctl daemon-reload
42 + sudo systemctl restart docker
43 +
44 + # 检查代理配置是否生效
45 + docker info | grep -i proxy

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 9 insertions, 3 deletions

git-reset.sh

@@ -3,11 +3,17 @@
3 3 git status
4 4
5 5 echo
6 - read -p "Are you sure you want to reset all local changes and pull from origin/main? This will discard all uncommitted changes. (y/n): " confirm
6 + read -p "Type 'y' to confirm reset and pull (Enter = yes, n = cancel): " confirm </dev/tty
7 7
8 - if [[ "$confirm" == "y" || "$confirm" == "Y" ]]; then
8 + # Treat empty input (Enter) as "y"
9 + confirm="${confirm:-y}"
10 +
11 + if [[ "$confirm" == "y" ]]; then
12 + echo "Proceeding with reset and pull..."
9 13 git reset --hard HEAD && git clean -fd && git fetch origin && git pull origin main
10 14 git status
15 + elif [[ "$confirm" == "n" ]]; then
16 + echo "Operation cancelled by user (n)."
11 17 else
12 - echo "Operation cancelled."
18 + echo "Operation cancelled. Only 'y' or Enter will proceed."
13 19 fi

uk's Avatar uk revised this gist 8 months ago. Go to revision

No changes

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 2 insertions, 3 deletions

git-reset.sh

@@ -7,8 +7,7 @@ read -p "Are you sure you want to reset all local changes and pull from origin/m
7 7
8 8 if [[ "$confirm" == "y" || "$confirm" == "Y" ]]; then
9 9 git reset --hard HEAD && git clean -fd && git fetch origin && git pull origin main
10 + git status
10 11 else
11 12 echo "Operation cancelled."
12 - fi
13 -
14 - git status
13 + fi

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 14 insertions

git-reset.sh(file created)

@@ -0,0 +1,14 @@
1 + #!/bin/bash
2 +
3 + git status
4 +
5 + echo
6 + read -p "Are you sure you want to reset all local changes and pull from origin/main? This will discard all uncommitted changes. (y/n): " confirm
7 +
8 + if [[ "$confirm" == "y" || "$confirm" == "Y" ]]; then
9 + git reset --hard HEAD && git clean -fd && git fetch origin && git pull origin main
10 + else
11 + echo "Operation cancelled."
12 + fi
13 +
14 + git status

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 1 insertion, 1 deletion

install_vmtools.sh

@@ -2,7 +2,7 @@
2 2 set -e
3 3
4 4 # Define variables
5 - ISO_FILENAME="SMTX_VMTOOLS-3.2.2-2501210639.iso"
5 + ISO_FILENAME="SMTX_VMTOOLS-3.2.2-2505290843.iso"
6 6 ISO_FILE="/tmp/${ISO_FILENAME}"
7 7 MOUNT_POINT="/mnt/wuke-vmtools"
8 8

uk's Avatar uk revised this gist 8 months ago. Go to revision

1 file changed, 2 insertions

install_vmtools.sh

@@ -22,6 +22,8 @@ elif [[ $GATEWAY == 172.29.80.* ]]; then
22 22 ISO_URL="http://172.29.80.5/VMTOOLS/${VMTOOLS_VERSION}/${ISO_FILENAME}"
23 23 elif [[ $GATEWAY == 172.29.112.* ]]; then
24 24 ISO_URL="http://172.29.112.5/VMTOOLS/${VMTOOLS_VERSION}/${ISO_FILENAME}"
25 + elif [[ $GATEWAY == 192.168.48.* ]]; then
26 + ISO_URL="http://192.168.48.2/VMTOOLS/${VMTOOLS_VERSION}/${ISO_FILENAME}"
25 27 else
26 28 echo "Unsupported gateway network: $GATEWAY"
27 29 exit 1
Newer Older