new scripts

This commit is contained in:
gaofei 2024-09-04 09:34:58 +08:00
parent e07a3134c5
commit a38c39a29d
4 changed files with 28 additions and 1 deletions

View File

@ -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

2
scripts/_set_proxy Normal file
View File

@ -0,0 +1,2 @@
export HTTP_PROXY=http://localhost:8889
export HTTPS_PROXY=http://localhost:8889

View File

@ -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

22
scripts/set-proxy Executable file
View File

@ -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 $@