CMD常用命令

开关机

  1. 定时关机
  2. shutdown -s -t 60
  3. 取消定时关机
  4. shutdown -a

文件

  1. md c:\test\myfolder
  2. rd /s /q [盘符:\][路径\]新目录名
  3. 因为rd只能删除空的文件夹,而如果其中有子文件或子文件夹的时候就会停下来,这时我们加上/s就可以直接删除,但是删除过程中会提示你是否确定删除,对于懒癌患者我们有添加了/q,即quiet,安静模式;所以使用以上命令会完整删除你选中的整个文件夹。
  4. 创建空文件
  5. type nul>a.txt
  6. 创建非空文件
  7. echo myname>a.txt
  8. 删除
  9. del a.txt
  10. $client = new-object System.Net.WebClient
  11. $client.DownloadFile('#1','#2')
  12. #1:下载链接 #2:保存地址+文件名

网络

  1. 延迟和丢包率:ping ip/域名
  2. Ping 测试 5 次:ping ip/域名 -n 5

保存为 .bat 可执行文件

我们可以将常用的命令输入记事本中,并保存为后缀为 .bat 的可执行文件。

以后只要双击该文件即可执行指定命令

将文件放入系统【启动】目录中,可以实现开机自动运行。

Git

新建文件夹命令是 mkdir+文件夹名

mkdir a

touch+文件名,直接新建一个文件

touch a.txt

编辑文件 vim 加文件名

vim a.txt

vim 使用简单教程链接

vim保存退出 冒号+wq

git基础
  1. 查看仓库状态
  2. git status
  3. 初始化仓库
  4. git init
  5. git 提交文件
  6. $ git add file1.txt
  7. $ git add file2.txt file3.txt
  8. 如果不想提交以上文件,可以移除缓存
  9. git rm --cached
  10. 提交以上缓存的文件,“写入关于提交内容的文字描述”
  11. $ git commit -m "add 3 files."
  12. git log 命令可以查看所有产生的 commit 记录

git add & git commit

看到这里估计很多人会有疑问,我想要提交直接进行 commit 不就行了么,为什么先要再 add
一次呢?首先 git add 是先把改动添加到一个「暂存区」,你可以理解成是一个缓存区域,临
时保存你的改动,而 git commit 才是最后真正的提交。这样做的好处就是防止误提交,当然
也有办法把这两步合并成一步,不过后面再介绍,建议新手先按部就班的一步步来。

git 分支
  1. 新建一个分支
  2. git branch myTestBranch
  3. 切换分支
  4. git checkout myTestBranch
  5. 新建一个a分支,并且自动切换到a分支
  6. git checkout -b a
  7. 将分支合并到主分支master
  8. 1.切换到 master 分支;
  9. 2.执行 git merge a
  10. # 可能会有冲突而合并失败,留个包袱,这个到后面进阶的时候再讲。
  11. 删除分支
  12. git branch -d a
  13. 有些时候可能会删除失败,比如如果a分支的代码还没有合并到master,你执行 git branch -d
  14. a 是删除不了的,它会智能的提示你a分支还有未合并的代码,但是如果你非要删除,那就
  15. 执行 git branch -D a 就可以强制删除a分支。
  16. 分支重命名
  17. git branch -m命令可以对已经存在的branch重名了
  18. 新建版本标签
  19. git tag v1.0
  20. 查看历史 tag 记录
  21. git tag
  22. 切换到 v1.0 tag的代码状态
  23. git checkout v1.0

向 GitHub 提交代码
  1. 生成SSH key
  2. ssh-keygen -t rsa
  3. 接着连续三个回车键(不需要输入密码)
  4. GitHub 上添加 SSH key

添加远程库
  1. git remote add [shortname] [url]

Push & Pull
  1. 本地代码推到远程仓库(把master分支pushorigin远程仓库)
  2. git push origin master
  3. 把远程仓库的最新代码拉下来
  4. git pull origin master
  5. ## 一般我们在 push 之前都会先 pull ,这样不容易冲突

create a new repository on the command line
  1. echo "# hellow-world" >> README.md
  2. git init
  3. git add README.md
  4. git commit -m "first commit"
  5. git branch -M master
  6. git remote add origin https://github.com/joelan96/hellow-world.git
  7. git push -u origin master

push an existing repository from the command line
  1. git remote add origin https://github.com/joelan96/hellow-world.git
  2. git branch -M master
  3. git push -u origin master

$ git —help
  1. $ git --help
  2. usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
  3. [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
  4. [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
  5. [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
  6. <command> [<args>]
  7. These are common Git commands used in various situations:
  8. start a working area (see also: git help tutorial)
  9. clone Clone a repository into a new directory
  10. init Create an empty Git repository or reinitialize an existing one
  11. work on the current change (see also: git help everyday)
  12. add Add file contents to the index
  13. mv Move or rename a file, a directory, or a symlink
  14. restore Restore working tree files
  15. rm Remove files from the working tree and from the index
  16. sparse-checkout Initialize and modify the sparse-checkout
  17. examine the history and state (see also: git help revisions)
  18. bisect Use binary search to find the commit that introduced a bug
  19. diff Show changes between commits, commit and working tree, etc
  20. grep Print lines matching a pattern
  21. log Show commit logs
  22. show Show various types of objects
  23. status Show the working tree status
  24. grow, mark and tweak your common history
  25. branch List, create, or delete branches
  26. commit Record changes to the repository
  27. merge Join two or more development histories together
  28. rebase Reapply commits on top of another base tip
  29. reset Reset current HEAD to the specified state
  30. switch Switch branches
  31. tag Create, list, delete or verify a tag object signed with GPG
  32. collaborate (see also: git help workflows)
  33. fetch Download objects and refs from another repository
  34. pull Fetch from and integrate with another repository or a local branch
  35. push Update remote refs along with associated objects
  36. 'git help -a' and 'git help -g' list available subcommands and some
  37. concept guides. See 'git help <command>' or 'git help <concept>'
  38. to read about a specific subcommand or concept.
  39. See 'git help git' for an overview of the system.

Latex

texdoc symbols 调用符号文档

ctrl+alt+j即可从代码跳到pdf。可以搜索latex sycnctex from cursor改成别的键
crtl+点击pdf即可反向查找,如图代码被白框包围。可以搜索Synctex:Keybinding 改成双击

setting.json配置文件
  1. {
  2. "latex-workshop.latex.recipes": [{
  3. "name": "xelatex",
  4. "tools": [
  5. "xelatex"
  6. ]
  7. }, {
  8. "name": "latexmk",
  9. "tools": [
  10. "latexmk"
  11. ]
  12. },
  13. {
  14. "name": "pdflatex -> bibtex -> pdflatex*2",
  15. "tools": [
  16. "pdflatex",
  17. "bibtex",
  18. "pdflatex",
  19. "pdflatex"
  20. ]
  21. }
  22. ],
  23. "latex-workshop.latex.tools": [{
  24. "name": "latexmk",
  25. "command": "latexmk",
  26. "args": [
  27. "-synctex=1",
  28. "-interaction=nonstopmode",
  29. "-file-line-error",
  30. "-pdf",
  31. "%DOCFILE%"
  32. ]
  33. }, {
  34. "name": "xelatex",
  35. "command": "xelatex",
  36. "args": [
  37. "-synctex=1",
  38. "-interaction=nonstopmode",
  39. "-file-line-error",
  40. "%DOCFILE%"
  41. ]
  42. }, {
  43. "name": "pdflatex",
  44. "command": "pdflatex",
  45. "args": [
  46. "-synctex=1",
  47. "-interaction=nonstopmode",
  48. "-file-line-error",
  49. "%DOCFILE%"
  50. ]
  51. }, {
  52. "name": "bibtex",
  53. "command": "bibtex",
  54. "args": [
  55. "%DOCFILE%"
  56. ]
  57. }],
  58. "latex-workshop.view.pdf.viewer": "tab",
  59. "latex-workshop.latex.clean.fileTypes": [
  60. "*.aux",
  61. "*.bbl",
  62. "*.blg",
  63. "*.idx",
  64. "*.ind",
  65. "*.lof",
  66. "*.lot",
  67. "*.out",
  68. "*.toc",
  69. "*.acn",
  70. "*.acr",
  71. "*.alg",
  72. "*.glg",
  73. "*.glo",
  74. "*.gls",
  75. "*.ist",
  76. "*.fls",
  77. "*.log",
  78. "*.fdb_latexmk"
  79. ],
  80. "editor.suggest.snippetsPreventQuickSuggestions": false,
  81. "editor.suggestSelection": "first",
  82. "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
  83. "java.configuration.checkProjectSettingsExclusions": false,
  84. "editor.fontSize": 16,
  85. "launch": {
  86. "configurations": [],
  87. "compounds": []
  88. }
  89. }

IDEA常用快捷键

顶部code 可以使用和查看所有快捷键

  1. Alt+Enter 导入包,自动修正代码
  2. Ctrl+Y 删除光标所在行
  3. Ctrl+D 复制光标所在行的内容,插入光标位置下面
  4. Ctrl+Alt+L 格式化代码
  5. Ctrl+/ 单行注释
  6. Ctrl+Shift+/ 选中代码注释,多行注释,再按取消注释
  7. Alt+Ins 自动生成代码,toStringgetset等方法
  8. Alt+Shift+ 上下箭头 移动当前代码行
  9. **ctrl+alt+t Surround With快捷键
  10. shift+f6 所有同名变量一起变
  11. array.fori 数组遍历
  12. array.forr 数组倒序遍历
  13. Ctrl+”+/-”,当前方法展开、折叠
  14. Ctrl+Shift+”+/-”,全部展开、折叠

Conda

  1. # 升级conda
  2. conda update conda
  3. # 升级anconda(需先升级conda)
  4. conda update anaconda
  5. # 升级python
  6. conda update python
  7. # 安装包,并且安装包所依赖的包
  8. !pip install missingno -U
  9. # 利用.yml文件 创建虚拟文件
  10. conda env create -f environment.yml -n new_env_name
  1. 二.创建虚拟环境的流程
  2. 1.在命令行输入
  3. conda create -n xxx python=3.6
  4. xxx为自己命名的虚拟环境名称,该文件可在Anaconda安装目录 envs文件下找到
  5. 2.使用激活(或切换不同python版本)的虚拟环境
  6. python --version # 可以检查当前python的版本
  7. Linux: source activate your_env_name(虚拟环境名称)
  8. ###Windows: conda activate your_env_name(虚拟环境名称)
  9. 三.对虚拟环境中安装额外的包
  10. conda install -n your_env_name [package]
  11. 四.关闭虚拟环境
  12. Linux: source deactivate
  13. Windows: deactivate
  14. 五.删除虚拟环境
  15. conda remove -n your_env_name(虚拟环境名称) --all
  16. conda remove --name your_env_name package_name # 删除环境中的某个包

PYTHON几种常见获取帮助的方式

  1. 直接在执行命令窗口输入help()命令,可以连续的查询帮助文档。
  2. help()
  3. help> print
  4. 也可以直接使用help(print)方式
  5. help(print)
  6. import tkinter
  7. print(dir(tkinter))
  8. import tkinter
  9. print(tkinter.__doc__)

Jupyter

  1. 在函数后面按入Shift+Tab组合键,查看对应的帮助文档

解决jupyter notebook无法找到虚拟环境的问题

  1. 1.首先进入到自己创建的虚拟环境(pytorch是虚拟环境的名字)
  2. activate pytorch
  3. 2.在该环境下下载这个库
  4. conda install ipykernel
  5. conda install nb_conda
  6. #我查了很多博主的文章,大部分都是虚拟环境缺这两个库,可能是版本原因,我只缺少了nb_conda这个库,下载之后就成功了。
  7. 3.打开jupyter notebook,我们就可以看到我们创建的虚拟环境pytorch
  8. jupyter notebook