常用笔记

常用笔记

Golang

proxy

GOPROXY=https://goproxy.cn,direct

build

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go
go build -tags=prod -ldflags "-s -w" -o app main.go

mod

go mod init name
go mod tidy

Python

pip

-i https://pypi.tuna.tsinghua.edu.cn/simple
pip install 你需要的包 -i https://pypi.tuna.tsinghua.edu.cn/simple

pip upgrade

python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple

Nodejs

npm error

npm ERR! Could not install from "Files\nodejs\node_cache\_npx\12848" as it does not contain a package.json file.

npm config set cache "D:\Program Files\nodejs\node_cache"--global

Vue

vuex

  • commit: 同步操作
this.$store.commit('asyncFnVal',name)
this.$store.state.val
  • dispatch: 异步操作
this.$store.dispatch('syncFnVal',name)
this.$store.getters.getVal

Swagger

  • 折叠api
http://xxxxx/swagger/index.html?docExpansion

Git

  • 从记录中删除
    • 删除记录 git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch path-to-your-remove-file' --prune-empty --tag-name-filter cat -- --all
    • 强制推送修改 git push origin master -f
    • 删除标签记录 git push origin master --force --tags
    • 清理和回收空间
      • rm -rf .git/refs/original/
      • git reflog expire --expire=now --all
      • git gc --prune=now