*nux发行版
Msys2
- 输入 pacman -Ss gcc,找到mingw-w64-x86_64,选取内容单击右键复制
- pacman -S mingw-w64-x86_64-gcc
- pacman -S mingw-w64-x86_64-gdb
- 安装llvm过程类似
镜像源:
http://mirrors.ustc.edu.cn/
https://mirrors.tuna.tsinghua.edu.cn/
http://mirror.bit.edu.cn/
Ubuntu
stty erase ^H
修改apt源:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.baksudo sed -i -e 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' -e 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.listsudo cp /etc/apt/sources.list.bak /etc/apt/sources.listsudo apt install clang lldb lld clang-tools clangdsudo apt install libc++-dev libc++abi-devsudo update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-9 100sudo apt install mysql-serversudo usermod -d /var/lib/mysql/ mysqlsudo mysql_secure_installationapt autoremove --purge //删除软件包
Fedora
添加软件源:(https://developer.aliyun.com/article/746822)
sudo mv /etc/yum.repos.d/fedora.repo /etc/yum.repos.d/fedora.repo.backupsudo mv /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates.repo.backupsudo wget -O /etc/yum.repos.d/fedora.repo http://mirrors.aliyun.com/repo/fedora.reposudo wget -O /etc/yum.repos.d/fedora-updates.repo http://mirrors.aliyun.com/repo/fedora-updates.reposudo dnf clean all && sudo dnf makecache
安装常用软件:
sudo dnf install cmake clang lld git clang-tools-extra
卸载软件的办法:
sudo dnf autoremove 包名
Darwin(MacOS)
Macports清理垃圾:
port clean --all allport -f uninstall inactive
递归卸载依赖包:
port uninstall --follow-dependencies <portname>
macports沙盒化方法:macports.conf里的sandbox_enable
WSL
安装wsl2的方法:https://docs.microsoft.com/en-us/windows/wsl/install-win10
下载各种distro:https://docs.microsoft.com/en-us/windows/wsl/install-manual
要自动挂载外置硬盘,首先在/etc/wsl.conf中启用mountFsTab,然后在/etc/fstab中添加D: /mnt/d drvfs {options} 0 0,其中的options可以在/etc/wsl.conf里找到,不带任何引号或括号,最后sudo mkdir /mnt/d
使systemctl可用:https://github.com/arkane-systems/genie
设置代理
用cat /etc/resolv.conf查看DNS的IP,这就是Windows主机的IP。然后在Windows中关闭防火墙,在clash中打开allow LAN。
各种CLI工具
Docker
安装方法
- 方法1:curl https://get.docker.com | sh
- 方法2:https://docs.docker.com/engine/install/fedora/#install-from-a-package和https://docs.docker.com/engine/install/linux-postinstall/
在docker的registry mirrors里添加https://registry.docker-cn.com 这个镜像站
CMake
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) 产生clangd需要的文件
参考
添加依赖:
FIND_PACKAGE(OpenMP REQUIRED)target_link_libraries(可执行文件名 PRIVATE OpenMP::OpenMP_CXX)#库很多的时候#set(LIBS lib1 lib2 lib3 ... libN)#target_link_libraries(MyExe1 PRIVATE ${LIBS})#target_link_libraries(MyExe2 PRIVATE ${LIBS})
把外部库引入时,如果不是自己拷贝而是使用vcpkg,使用find_package()和target_link_libraries()即可,其余选项的区别如下:
INCLUDE_DIRECTORIES(添加头文件目录) 它相当于g++选项中的-I参数的作用,也相当于环境变量中增加路径到CPLUS_INCLUDE_PATH变量的作用(这里特指c++。c和Java中用法类似)。
比如: include_directories(“/opt/MATLAB/R2012a/extern/include”)
export CPLUS_INCLUDE_PATH=CPLUS_INCLUDE_PATH:$MATLAB/extern/include
LINK_DIRECTORIES(添加需要链接的库文件目录) 语法: link_directories(directory1 directory2 …)
它相当于g++命令的-L选项的作用,也相当于环境变量中增加LD_LIBRARY_PATH的路径的作用。
比如: LINK_DIRECTORIES(“/opt/MATLAB/R2012a/bin/glnxa64”)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MATLAB/bin/glnxa64
LINK_LIBRARIES(添加需要链接的库文件路径,注意这里是全路径)
比如: LINK_LIBRARIES(“/opt/MATLAB/R2012a/bin/glnxa64/libeng.so”)
TARGET_LINK_LIBRARIES (设置要链接的库文件的名称) 语法:TARGET_LINK_LIBRARIES(targetlibrary1
library2 ..) 比如(以下写法(包括备注中的)都可以): TARGET_LINK_LIBRARIES(myProject hello),连接libhello.so库 TARGET_LINK_LIBRARIES(myProject libhello.a) TARGET_LINK_LIBRARIES(myProject libhello.so) TARGET_LINK_LIBRARIES(myProject -lhello) ———————————————— 原文链接:https://blog.csdn.net/arackethis/article/details/43488177
使用GLOB语法:
file(GLOB MY_FILES "*.txt")file(COPY ${MY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
在C++内获得文件路径:
set(PILOT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
上面的代码会生成一个名叫PILOT_ROOT_DIR的宏,编译时就会变成对应路径的字符串字面量。
Python
virtualenv导出配置方法:https://medium.com/wealthy-bytes/the-easiest-way-to-use-a-python-virtual-environment-with-git-401e07c39cd
递归卸载pip包:
pip3 install pip-autoremovepip-autoremove somepackage -y
Git
设置和取消代理
git config --global http.proxy http://ip:port#git config --global https.proxy http://ip:port#git config --global --unset http.proxy
设置邮箱
git config --global user.name "Cook21"git config --global user.email "null"
推送到远程仓库
git remote add origin https://github.com/Cook21/xxxxx.gitgit branch -M maingit push -u origin main
从远程仓库下载
git clone https://github.com/Cook21/xxxxx.git
想fork但是不想设置成public
- 创建一个私有repo
git clone <private-repo>git remote add upstream <prublic-repo>git pull upstream main.gitignore
```cmake
Xcode specific
!*/.xcodeproj/* xcuserdata/
/.xcodeproj/project.xcworkspace/ !/*.xcodeproj/project.xcworkspace/xcshareddata
/.xcodeproj/project.xcworkspace/xcshareddata/ !/*.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
/.playground/playground.xcworkspace/ !/*.playground/playground.xcworkspace/xcshareddata
/.playground/playground.xcworkspace/xcshareddata/ !/*.playground/playground.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ```
各种SQLDB
https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database
