0%

mac shell use proxy

默认是 1087(不是 1086 也不是 1089)

1
2
export http_proxy='http://127.0.0.1:1087'
export https_proxy=$http_proxy

测试地址

1
curl https://www.bbc.com/

写入 ~/.zshrc

1
alias p10='export http_proxy="http://127.0.0.1:1087";export https_proxy=$http_proxy;echo -e 已开启代理'

或者

1
2
3
4
5
6
7
8
9
10
11
function proxy(){
export http_proxy='http://127.0.0.1:1087'
export https_proxy=$http_proxy
echo " \e[41m 已开启代理"
}

function proxy_off(){
unset http_proxy
unset https_proxy
echo -e "已关闭代理"
}

注意 = 后面不能有空格!!!!

export http_proxy=这里不能有空格’http://127.0.0.1:1087'

shell 颜色语法

1
2
3
\e
\033
\x1B

tput 颜色

1
2
3
4
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo "${red}red text ${green}green text${reset}"
1
echo "$(tput setaf 1)Red text $(tput setab 7)and white background$(tput sgr 0)"

tput setab [1-7] # Set the background colour using ANSI escape
tput setaf [1-7] # Set the foreground colour using ANSI escape

Num Colour #define R G B

0 black COLOR_BLACK 0,0,0
1 red COLOR_RED 1,0,0
2 green COLOR_GREEN 0,1,0
3 yellow COLOR_YELLOW 1,1,0
4 blue COLOR_BLUE 0,0,1
5 magenta COLOR_MAGENTA 1,0,1
6 cyan COLOR_CYAN 0,1,1
7 white COLOR_WHITE 1,1,1

字符画

1
2
3
4
5
6
7
  ,--,   .-. .-. .---.    .---. .-. .-..-. .-.  .--.  .-. .-.  ,--,   
.' .' | | | |/ .-. ) ( .-._)| | | || | | | / /\ \ | \| |.' .'
| | __ | | | || | |(_)(_) \ | `-' || | | |/ /__\ \| | || | __
\ \ ( _)| | | || | | | _ \ \ | .-. || | | || __ || |\ |\ \ ( _)
\ `-) )| `-')|\ `-' /( `-' ) | | |)|| `-')|| | |)|| | |)| \ `-) )
)\____/ `---(_) )---' `----' /( (_)`---(_)|_| (_)/( (_) )\____/
(__) (_) (__) (__) (__)

vscode 命令行

Command+Shift+p 输入 shell

选择 install code command in path

在终端打开项目

1
code 目录名  

原理

其实是放了链接

1
/usr/local/bin

查看

1
which code

其他方式

1
open -a "Visual Studio Code"

vsode 根据项目修改颜色

https://dockyard.com/blog/2019/07/15/follow-these-steps-to-enable-vs-code-color-customization

编辑 .vscode/settings.json

1
2
3
4
5
6
7
8
9
10
{
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#a8e6cf",
"titleBar.inactiveBackground": "#a8e6cf",
"titleBar.activeForeground": "#000",
"titleBar.inactiveForeground": "#000",
"statusBar.foreground": "#000",
"statusBar.background": "#a8e6cf"
}
}

加入 .gitignore

Open Terminal

Run touch ~/.gitignore_global to create a global .gitignore file in your home directory

Run open ~/.gitignore_global to open the file

Add .vscode/ to the file

Run git config –global core.excludesfile ~/.gitignore_global