vscode

插件:

  • C/C++, ~ Extension Pack, Themes, InteliCode
  • CMake Tools, CodeLLDB
  • Vim
  • remote ssh, docker
  • Error Lens, GitLens

user的settings.json

    "editor.fontFamily": "Fira Code",
    "workbench.panel.defaultLocation": "right",
    
    "vim.handleKeys": {
        "<C-c>": false,
        "<C-f>": false,
        "<C-x>": false,
        "<C-a>": false,
        "<C-p>": false,
    },
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.block": "sameLine",
    "C_Cpp.vcFormat.newLine.beforeOpenBrace.function": "sameLine",
    "editor.formatOnSave": true,
    "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 2, TabWidth: 2}",

pip, python, pyenv

使用pyenv控制多个python版本

pyenv versions # 查看所有安装的python脚本
pyenv install 3.8.0 # 安装python 3.8.0
pyenv global 3.8.0 # 将3.8.0设置为全局python,对应pip也会改变

删除__pycache__

find . -name "*.pyc" -type f -print -exec rm -rf {} \;

about clash

# start.sh
nohup ./clash -d . >/dev/null 2>&1 &
#shutdown.sh
ps -A | grep clash | awk '{print $1}' | xargs kill

暂时设置7890做全局代理

export HTTPS_PROXY="http://127.0.0.1:7890"
# unset HTTPS_PROXY

docker

  1. 启动镜像
sudo docker run -it -d --name=<name> --privileged --net=host --ipc=host --gpus=all -v /opt:/opt2 repo/tag

2.进入容器的bash命令行

sudo docker exec -it <name> bash
  1. make and run
sudo docker build -t <name> -f Dockerfile .
  1. 将当前容器的镜像push到远程repo,首先确保自己登录了docker,没有登录的话先登录:
docker login -u <用户名> -p <密码>
sudo docker commit <container_id> <repo>/<tag>
sudo docker push <repo>/<tag>
  1. 删除image之前需要先删除容器
sudo docker ps
sudo docker rm <container>
sudo docker image ls
sudo docker rmi <image>

others

import torch
print(*torch.__config__.show().split("\n"), sep="\n")