杂记
安装 Conda
安装 Anaconda:
- wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh
- chmod +x Anaconda3-2022.05-Linux-x86_64.sh
- ./Anaconda3-2022.05-Linux-x86_64.sh
安装到最后有一个提示:Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no]。我选择 no。
然后自己添加 PATH:
- nano ~/.bashrc
- export PATH="/home/tim/anaconda3/bin:$PATH"
自己初始化:
- echo $SHELL
- conda init bash
conda 重置环境
删除环境:
- conda remove --name py38 --all
重装:
- conda create --name py38 python=3.8
conda 多个库兼容
- conda create -n myenv -c conda-forge python=3.9 qt opencv pyside2
python 库环境路径
- python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
SSH Keys
生成 SSH Key:
- ssh-keygen -t ed25519 -C "your_email@example.com"
查看:
- cat ~/.ssh/id_ed25519.pub
Software Properties Tool
- sudo apt install software-properties-common
- sudo add-apt-repository main
- sudo add-apt-repository universe
- sudo add-apt-repository restricted
- sudo add-apt-repository multiverse
- sudo apt update
移除 deb
查看:
- dpkg -l | grep [package-name]
移除:
- sudo dpkg -r [package-name]
- sudo dpkg --purge [package-name]
.gitconfig
- git config --global user.name "Your Name"
- git config --global user.email "your.email@example.com"
git clone 子模块
- git clone --recurse-submodules your-repo.git
如果已经克隆了仓库,但是忘记了克隆子模块,可以使用以下命令补充:
- git submodule update --init --recursive
git 自动创建远程分支
- git push -u origin new-branch
分支冲突检查
先拉取检查分支的最新状态:
- git fetch origin develop
再在当前分支上:
- git rebase origin/develop
git lfs
- sudo apt-get install git-lfs
- git lfs pull
强制同步仓库
- git fetch origin
- git reset --hard origin/main
暂存
- git stash
- git stash pop
只修改提交时间戳
- git commit --amend --no-edit
Qt dev
- sudo apt-get update
- sudo apt-get install qt5-default qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
VSCode 后退返回之前文件
快捷键 Ctrl + Alt + -。
重新安装 NVIDIA 驱动
- sudo apt-get purge nvidia-*
- sudo apt-get autoremove
- sudo add-apt-repository ppa:graphics-drivers/ppa
- sudo apt-get update
- sudo apt-get install nvidia-driver-535
- sudo reboot
安装 CUDA 11.0
- sudo apt-get install cuda-11-0
安装 NVIDIA Docker
- sudo apt-get install nvidia-docker2
重新安装 pip
- python -m ensurepip
json 格式化
- python -m json.tool input.json > output.json
carla 画坐标轴
- def draw_axes(world, start_location, length=1000, thickness=0.5, life_time=120.0):
- # 将Z轴稍微抬高,避免与地面重叠
- origin = carla.Location(start_location.x, start_location.y, start_location.z + 0.5)
- # 定义各个轴的终点位置
- x_end = carla.Location(x=start_location.x + length, y=start_location.y, z=start_location.z + 0.5)
- y_end = carla.Location(x=start_location.x, y=start_location.y + length, z=start_location.z + 0.5)
- z_end = carla.Location(x=start_location.x, y=start_location.y, z=start_location.z + length + 0.5)
- # X轴,红色
- world.debug.draw_line(origin, x_end, thickness=thickness, color=carla.Color(255, 0, 0), life_time=life_time)
- # Y轴,绿色
- world.debug.draw_line(origin, y_end, thickness=thickness, color=carla.Color(0, 255, 0), life_time=life_time)
- # Z轴,蓝色
- world.debug.draw_line(origin, z_end, thickness=thickness, color=carla.Color(0, 0, 255), life_time=life_time)
screen 会话
列出当前的 screen 会话:
- screen -list
重新进入会话:
- screen -r 44125
jemalloc
- export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
- export MALLOC_CONF=prof_leak:true,lg_prof_sample:0,prof_final:true
- call (int)mallctl("prof.dump", 0, 0, 0, 0)
使用jeprof工具:
- jeprof --show_bytes --lines mem jeprof.149463.0.f.heap