辅助命令记录

一些有用的命令记录

chrome开启跨域

1
open -n /Applications/Google\ Chrome.app/ --args --disable-web-security  --user-data-dir=/Users/cc/MyChromeDevUserData 

Mac修改hosts

1
2
3
cd /etc
sudo vim /etc/hosts
source /etc/hosts //刷新配置

Mac查看端口

1
2
lsof -i tcp:8080
sudo kill -9 PID 如:sudo kill -9 3210 //看到进程的PID,可以将进程杀死

git统计代码量

1
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --since=2023-09-22 --until=2023-09-28 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done;

导出vuepress文档为pdf

1
npx mr-pdf --initialDocURLs="https://tcd.zeekrlife.com/doc/authcenter/" --contentSelector="main" --paginationSelector=".page-nav .next a" --excludeSelectors="header.navbar,aside.sidebar,footer.page-edit .edit-link,.global-ui,.page-nav" --coverImage="https://vuepress.vuejs.org/hero.png" --coverTitle=“我是test文档” --coverSub=“我是文档的副标题”