Tree
# 安装
brew install tree
# 使用
tree -d // 只显示文件夹
tree -L n // 显示项目的层级 n表示层级数
tree -I pattern // 用于过滤不想要显示的文件或者文件夹
tree > tree.md // 将项目结构输出到 tree.md 这个文件
#
清除 dns 缓存
# OS X Mountain Lion or Lion
sudo dscacheutil -flushcache
# Mac OS X v10.6
sudo killall -HUP mDNSResponder
nginx
# 安装
brew install nginx
# 重启
nginx -s reload
初始化 git
# 生成 ssh
ssh-keygen -t rsa -C ""
# 别名
ssh-keygen -t rsa -f ~/.ssh/zhongan -C ""
# 设置姓名/邮箱
git config --global user.name "zhanghao"
git config --global user.email ""
# 关闭 SSL 验证
git config --global http.sslVerify false
安装 oh-my-zsh
# <https://www.jianshu.com/p/ba08713c2b19>
sh -c "$(curl -fsSL <https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh>)"
autojump
# 安装
brew install autojump
# zshrc 配置
# 编辑 vi ~/.zshrc
plugins=(git autojump)
[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
# 刷新配置
source ~/.zshrc
# 目录权限问题
chmod 755 /opt/homebrew/share/zsh
# 删除 Last Login
touch ~/.hushlogin
安装 brew
# <https://zhuanlan.zhihu.com/p/59805070>
# <https://zhuanlan.zhihu.com/p/112383265?from_voters_page=true>
git clone git://mirrors.ustc.edu.cn/homebrew-core.git//usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
# 使用国内镜像
/bin/zsh -c "$(curl -fsSL <https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh>)"
# 解除锁定
rm -rf /usr/local/var/homebrew/locks
# 或者这样
sudo chown -R "$USER":admin /usr/local
brew cleanup
环境变量
# 编辑
vi ~/.bash_profile
# 刷新
source ~/.bash_profile
curl https
# <https://blog.csdn.net/lixuande19871015/article/details/88788699>
# 下载证书
<https://curl.haxx.se/ca/cacert.pem>
# 设置环境变量
vi ~/.bash_profile
export CURL_CA_BUNDLE=/etc/curlssl/cacert.pem
source ~/.bash_profile
VSCode
# 设置字体
<https://blog.csdn.net/chenghai37/article/details/81417293>
设置文件权限
# 找到模块地址
npm root -g
# 设置权限
sudo chown -R $applename ../node_modules
Github 访问慢
# <https://github.com.ipaddress.com/>
# 刷新 cdn
dscacheutil -flushcache
GitLab 同步 fork 分支
# 添加项目远程仓库到 upstream
git remote add upstream <仓库地址>
# 删除本地 upstream
git remote rm upstream
# 查看配置信息
git config --list
# 更新到本地的 upstream
git fetch upstream
# merge
git merge upstream/master
Git 多账号登录
<https://www.barretlee.com/blog/2016/03/09/config-in-ssh-after-troubling-git-connection/>
# ~/.ssh/config
# personal server
Host personal
HostName proxy1.barretlee.com proxy2.barretlee.com
User barretlee
IdentityFile ~/.ssh/proxy.barretlee.com.key
# school
HostName 222.20.74.89
User school
LocalForward 8999 127.0.0.1:3306
IdentityFile ~/.ssh/school.key
# and so on.
husky 配置
npm install husky lint-staged commitlint -D && npx husky init
//.husky/pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
npx --no-install commitlint --edit $1
# 增加权限
chmod ug+x .husky/*
chmod ug+x .git/hooks/*
网友评论