From 9e48f6f42c0ffa8874185183967ea899b23391a1 Mon Sep 17 00:00:00 2001 From: gaofei Date: Wed, 4 Sep 2024 09:06:27 +0800 Subject: [PATCH 1/5] add mac profile --- profiles/mac/profile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 profiles/mac/profile diff --git a/profiles/mac/profile b/profiles/mac/profile new file mode 100644 index 0000000..034c5bc --- /dev/null +++ b/profiles/mac/profile @@ -0,0 +1,5 @@ +alias l='ls -lhF' +alias ll=l +alias la='ls -AlhF' + +export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%c%{%} $(git_prompt_info)' From e07a3134c58b29ee0e5af6d171a3125c9d2cb5ee Mon Sep 17 00:00:00 2001 From: gaofei Date: Wed, 4 Sep 2024 09:07:54 +0800 Subject: [PATCH 2/5] update profile --- profiles/mac/profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/mac/profile b/profiles/mac/profile index 034c5bc..461b4ea 100644 --- a/profiles/mac/profile +++ b/profiles/mac/profile @@ -2,4 +2,4 @@ alias l='ls -lhF' alias ll=l alias la='ls -AlhF' -export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%c%{%} $(git_prompt_info)' +export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%~%{%} $(git_prompt_info)' From a38c39a29dbeacab8532bbef9bd3251c0b2a3b22 Mon Sep 17 00:00:00 2001 From: gaofei Date: Wed, 4 Sep 2024 09:34:58 +0800 Subject: [PATCH 3/5] new scripts --- profiles/mac/profile | 1 + scripts/_set_proxy | 2 ++ scripts/connect | 4 +++- scripts/set-proxy | 22 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 scripts/_set_proxy create mode 100755 scripts/set-proxy diff --git a/profiles/mac/profile b/profiles/mac/profile index 461b4ea..4d33560 100644 --- a/profiles/mac/profile +++ b/profiles/mac/profile @@ -3,3 +3,4 @@ alias ll=l alias la='ls -AlhF' export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%~%{%} $(git_prompt_info)' +export PATH=$PATH:/Users/gaofei/Projects/github.com/magic/scripts diff --git a/scripts/_set_proxy b/scripts/_set_proxy new file mode 100644 index 0000000..f062ca3 --- /dev/null +++ b/scripts/_set_proxy @@ -0,0 +1,2 @@ +export HTTP_PROXY=http://localhost:8889 +export HTTPS_PROXY=http://localhost:8889 diff --git a/scripts/connect b/scripts/connect index 4da612d..90306ab 100755 --- a/scripts/connect +++ b/scripts/connect @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash GREEN='\033[0;32m' RED='\033[0;31m' @@ -27,6 +27,7 @@ servers["jp"]="ssh root@jp.xxoommd.asia" servers["yact"]="ssh root@172.50.10.83" function help() { + echo echo "Usage:" echo -e " 1.SSH to server: con (${GREEN}-C${NC}|${GREEN}--connect-host${NC} can be omitted) [NAME]" echo -e " Options:" @@ -47,6 +48,7 @@ function help() { printf "${NC}%-24s${NC}" "$user@$host" printf "${YELLOW}%-16s${NC}\n" " ssh_port:$port" done + echo } # parse_ssh_string: Parse ssh command to port, user, port diff --git a/scripts/set-proxy b/scripts/set-proxy new file mode 100755 index 0000000..07561b2 --- /dev/null +++ b/scripts/set-proxy @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +function show() { + echo + echo "HTTP_PROXY=$HTTP_PROXY" + echo "HTTPS_PROXY=$HTTPS_PROXY" + echo +} + +function main() { + if [[ $1 == "on" ]]; then + DIR="$(dirname "${BASH_SOURCE[0]}")" + source $DIR/_set_proxy + elif [[ $1 == "off" ]]; then + unset HTTP_PROXY + unset HTTPS_PROXY + fi + + show +} + +main $@ From 949d3c85e6722d97c70aa52ebb59f1aaa6269209 Mon Sep 17 00:00:00 2001 From: gaofei Date: Wed, 4 Sep 2024 11:11:20 +0800 Subject: [PATCH 4/5] update --- profiles/mac/profile | 1 + scripts/_set_proxy | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/profiles/mac/profile b/profiles/mac/profile index 4d33560..d96f816 100644 --- a/profiles/mac/profile +++ b/profiles/mac/profile @@ -4,3 +4,4 @@ alias la='ls -AlhF' export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%~%{%} $(git_prompt_info)' export PATH=$PATH:/Users/gaofei/Projects/github.com/magic/scripts +export PATH="/usr/local/opt/node@20/bin:$PATH" diff --git a/scripts/_set_proxy b/scripts/_set_proxy index f062ca3..f1fb27c 100644 --- a/scripts/_set_proxy +++ b/scripts/_set_proxy @@ -1,2 +1,2 @@ -export HTTP_PROXY=http://localhost:8889 -export HTTPS_PROXY=http://localhost:8889 +export HTTP_PROXY="http://localhost:28080" +export HTTPS_PROXY="http://localhost:28080" From e66e5f537bb3d989f0303dce58007b841e13e705 Mon Sep 17 00:00:00 2001 From: gaofei Date: Wed, 4 Sep 2024 11:42:27 +0800 Subject: [PATCH 5/5] update --- profiles/mac/profile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/profiles/mac/profile b/profiles/mac/profile index d96f816..8fe2eab 100644 --- a/profiles/mac/profile +++ b/profiles/mac/profile @@ -5,3 +5,7 @@ alias la='ls -AlhF' export PS1='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %{%}%~%{%} $(git_prompt_info)' export PATH=$PATH:/Users/gaofei/Projects/github.com/magic/scripts export PATH="/usr/local/opt/node@20/bin:$PATH" + +export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git" +export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api" +export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"