uk revisó este gist 1 week ago. Ir a la revisión
1 file changed, 8 insertions, 9 deletions
install_ohmyzsh.sh
| @@ -19,31 +19,28 @@ else | |||
| 19 | 19 | fi | |
| 20 | 20 | ||
| 21 | 21 | # install oh-my-zsh | |
| 22 | - | git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git | |
| 23 | - | REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh ohmyzsh/tools/install.sh && rm -rf ohmyzsh | |
| 22 | + | # git clone https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git | |
| 23 | + | # REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/ohmyzsh.git sh ohmyzsh/tools/install.sh && rm -rf ohmyzsh | |
| 24 | + | REPO=sjtug/ohmyzsh REMOTE=https://git.sjtu.edu.cn/${REPO}.git sh -c "$(curl -fsSL https://git.sjtu.edu.cn/sjtug/ohmyzsh/-/raw/master/tools/install.sh\?inline\=false)" | |
| 24 | 25 | ||
| 25 | 26 | ZSH=$HOME/.oh-my-zsh | |
| 26 | 27 | ||
| 27 | 28 | # install zsh-syntax-highlighting | |
| 28 | 29 | # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
| 29 | 30 | git clone https://mirrors.nju.edu.cn/git/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting | |
| 30 | - | # echo "source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc | |
| 31 | 31 | ||
| 32 | 32 | # install zsh-autosuggestions | |
| 33 | 33 | # git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
| 34 | 34 | git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plugins/zsh-autosuggestions | |
| 35 | - | # echo "source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc | |
| 36 | 35 | ||
| 37 | 36 | # install zsh-you-should-use | |
| 38 | 37 | # git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use | |
| 39 | - | git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $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 | 39 | ||
| 41 | 40 | # replace plugins and theme | |
| 42 | 41 | cp $HOME/.zshrc $HOME/.zshrc.bak | |
| 43 | - | zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo you-should-use' | |
| 42 | + | zsh -c 'source ~/.zshrc && omz plugin enable zsh-autosuggestions zsh-syntax-highlighting sudo' | |
| 44 | 43 | zsh -c 'source ~/.zshrc && omz theme set ys' | |
| 45 | - | # sed -i 's/(git/(git zsh-syntax-highlighting zsh-autosuggestions sudo/g' ~/.zshrc | |
| 46 | - | # sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/g' ~/.zshrc | |
| 47 | 44 | ||
| 48 | 45 | cat >> ~/.zshrc <<UK | |
| 49 | 46 | ||
| @@ -51,4 +48,6 @@ cat >> ~/.zshrc <<UK | |||
| 51 | 48 | zstyle ':omz:update' mode disabled | |
| 52 | 49 | HIST_STAMPS="yyyy-mm-dd" | |
| 53 | 50 | alias vi="vim" | |
| 54 | - | UK | |
| 51 | + | UK | |
| 52 | + | ||
| 53 | + | source ~/.zshrc | |
uk revisó este gist 1 week ago. Ir a la revisión
1 file changed, 1 insertion, 2 deletions
install_ohmyzsh.sh
| @@ -23,7 +23,6 @@ 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 | 27 | # install zsh-syntax-highlighting | |
| 29 | 28 | # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
| @@ -37,7 +36,7 @@ git clone https://mirrors.nju.edu.cn/git/zsh-autosuggestions.git $ZSH/custom/plu | |||
| 37 | 36 | ||
| 38 | 37 | # install zsh-you-should-use | |
| 39 | 38 | # git clone https://github.com/MichaelAquilina/zsh-you-should-use.git ${ZSH_CUSTOM:-~/.oh-my-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 | + | git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH/custom/plugins/you-should-use | |
| 41 | 40 | ||
| 42 | 41 | # replace plugins and theme | |
| 43 | 42 | cp $HOME/.zshrc $HOME/.zshrc.bak | |
uk revisó este gist 8 months ago. Ir a la revisión
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 revisó este gist 8 months ago. Ir a la revisión
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 revisó este gist 9 months ago. Ir a la revisión
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 revisó este gist 10 months ago. Ir a la revisión
1 file changed, 45 insertions
set-docker-prosy.sh(archivo creado)
| @@ -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 revisó este gist 10 months ago. Ir a la revisión
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 revisó este gist 10 months ago. Ir a la revisión
Sin cambios
uk revisó este gist 10 months ago. Ir a la revisión
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 revisó este gist 10 months ago. Ir a la revisión
1 file changed, 14 insertions
git-reset.sh(archivo creado)
| @@ -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 | |