CMD常用命令
开关机
定时关机shutdown -s -t 60取消定时关机shutdown -a
文件
md c:\test\myfolderrd /s /q [盘符:\][路径\]新目录名因为rd只能删除空的文件夹,而如果其中有子文件或子文件夹的时候就会停下来,这时我们加上/s就可以直接删除,但是删除过程中会提示你是否确定删除,对于懒癌患者我们有添加了/q,即quiet,安静模式;所以使用以上命令会完整删除你选中的整个文件夹。创建空文件type nul>a.txt创建非空文件echo myname>a.txt删除del a.txt$client = new-object System.Net.WebClient$client.DownloadFile('#1','#2')#1:下载链接 #2:保存地址+文件名
网络
延迟和丢包率:ping ip/域名Ping 测试 5 次:ping ip/域名 -n 5
保存为 .bat 可执行文件
我们可以将常用的命令输入记事本中,并保存为后缀为 .bat 的可执行文件。
以后只要双击该文件即可执行指定命令
将文件放入系统【启动】目录中,可以实现开机自动运行。
Git
新建文件夹命令是 mkdir+文件夹名
mkdir a
touch+文件名,直接新建一个文件
touch a.txt
编辑文件 vim 加文件名
vim a.txt
vim保存退出 冒号+wq
git基础
查看仓库状态git status初始化仓库git initgit 提交文件$ git add file1.txt$ git add file2.txt file3.txt如果不想提交以上文件,可以移除缓存git rm --cached提交以上缓存的文件,“写入关于提交内容的文字描述”$ git commit -m "add 3 files."git log 命令可以查看所有产生的 commit 记录
git add & git commit
看到这里估计很多人会有疑问,我想要提交直接进行 commit 不就行了么,为什么先要再 add
一次呢?首先 git add 是先把改动添加到一个「暂存区」,你可以理解成是一个缓存区域,临
时保存你的改动,而 git commit 才是最后真正的提交。这样做的好处就是防止误提交,当然
也有办法把这两步合并成一步,不过后面再介绍,建议新手先按部就班的一步步来。
git 分支
新建一个分支git branch myTestBranch切换分支git checkout myTestBranch新建一个a分支,并且自动切换到a分支git checkout -b a将分支合并到主分支master1.切换到 master 分支;2.执行 git merge a# 可能会有冲突而合并失败,留个包袱,这个到后面进阶的时候再讲。删除分支git branch -d a有些时候可能会删除失败,比如如果a分支的代码还没有合并到master,你执行 git branch -da 是删除不了的,它会智能的提示你a分支还有未合并的代码,但是如果你非要删除,那就执行 git branch -D a 就可以强制删除a分支。分支重命名git branch -m命令可以对已经存在的branch重名了新建版本标签git tag v1.0查看历史 tag 记录git tag切换到 v1.0 tag的代码状态git checkout v1.0
向 GitHub 提交代码
生成SSH keyssh-keygen -t rsa接着连续三个回车键(不需要输入密码)GitHub 上添加 SSH key
添加远程库
git remote add [shortname] [url]
Push & Pull
本地代码推到远程仓库(把master分支push到origin远程仓库)git push origin master把远程仓库的最新代码拉下来git pull origin master## 一般我们在 push 之前都会先 pull ,这样不容易冲突
create a new repository on the command line
echo "# hellow-world" >> README.mdgit initgit add README.mdgit commit -m "first commit"git branch -M mastergit remote add origin https://github.com/joelan96/hellow-world.gitgit push -u origin master
push an existing repository from the command line
git remote add origin https://github.com/joelan96/hellow-world.gitgit branch -M mastergit push -u origin master
$ git —help
$ git --helpusage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path][-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]<command> [<args>]These are common Git commands used in various situations:start a working area (see also: git help tutorial)clone Clone a repository into a new directoryinit Create an empty Git repository or reinitialize an existing onework on the current change (see also: git help everyday)add Add file contents to the indexmv Move or rename a file, a directory, or a symlinkrestore Restore working tree filesrm Remove files from the working tree and from the indexsparse-checkout Initialize and modify the sparse-checkoutexamine the history and state (see also: git help revisions)bisect Use binary search to find the commit that introduced a bugdiff Show changes between commits, commit and working tree, etcgrep Print lines matching a patternlog Show commit logsshow Show various types of objectsstatus Show the working tree statusgrow, mark and tweak your common historybranch List, create, or delete branchescommit Record changes to the repositorymerge Join two or more development histories togetherrebase Reapply commits on top of another base tipreset Reset current HEAD to the specified stateswitch Switch branchestag Create, list, delete or verify a tag object signed with GPGcollaborate (see also: git help workflows)fetch Download objects and refs from another repositorypull Fetch from and integrate with another repository or a local branchpush Update remote refs along with associated objects'git help -a' and 'git help -g' list available subcommands and someconcept guides. See 'git help <command>' or 'git help <concept>'to read about a specific subcommand or concept.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配置文件
{"latex-workshop.latex.recipes": [{"name": "xelatex","tools": ["xelatex"]}, {"name": "latexmk","tools": ["latexmk"]},{"name": "pdflatex -> bibtex -> pdflatex*2","tools": ["pdflatex","bibtex","pdflatex","pdflatex"]}],"latex-workshop.latex.tools": [{"name": "latexmk","command": "latexmk","args": ["-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","%DOCFILE%"]}, {"name": "xelatex","command": "xelatex","args": ["-synctex=1","-interaction=nonstopmode","-file-line-error","%DOCFILE%"]}, {"name": "pdflatex","command": "pdflatex","args": ["-synctex=1","-interaction=nonstopmode","-file-line-error","%DOCFILE%"]}, {"name": "bibtex","command": "bibtex","args": ["%DOCFILE%"]}],"latex-workshop.view.pdf.viewer": "tab","latex-workshop.latex.clean.fileTypes": ["*.aux","*.bbl","*.blg","*.idx","*.ind","*.lof","*.lot","*.out","*.toc","*.acn","*.acr","*.alg","*.glg","*.glo","*.gls","*.ist","*.fls","*.log","*.fdb_latexmk"],"editor.suggest.snippetsPreventQuickSuggestions": false,"editor.suggestSelection": "first","vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue","java.configuration.checkProjectSettingsExclusions": false,"editor.fontSize": 16,"launch": {"configurations": [],"compounds": []}}
IDEA常用快捷键
顶部code 可以使用和查看所有快捷键
Alt+Enter 导入包,自动修正代码Ctrl+Y 删除光标所在行Ctrl+D 复制光标所在行的内容,插入光标位置下面Ctrl+Alt+L 格式化代码Ctrl+/ 单行注释Ctrl+Shift+/ 选中代码注释,多行注释,再按取消注释Alt+Ins 自动生成代码,toString,get,set等方法Alt+Shift+ 上下箭头 移动当前代码行**ctrl+alt+t Surround With快捷键shift+f6 所有同名变量一起变array.fori 数组遍历array.forr 数组倒序遍历Ctrl+”+/-”,当前方法展开、折叠Ctrl+Shift+”+/-”,全部展开、折叠
Conda
# 升级condaconda update conda# 升级anconda(需先升级conda)conda update anaconda# 升级pythonconda update python# 安装包,并且安装包所依赖的包!pip install missingno -U# 利用.yml文件 创建虚拟文件conda env create -f environment.yml -n new_env_name
二.创建虚拟环境的流程1.在命令行输入conda create -n xxx python=3.6xxx为自己命名的虚拟环境名称,该文件可在Anaconda安装目录 envs文件下找到2.使用激活(或切换不同python版本)的虚拟环境python --version # 可以检查当前python的版本Linux: source activate your_env_name(虚拟环境名称)###Windows: conda activate your_env_name(虚拟环境名称)三.对虚拟环境中安装额外的包conda install -n your_env_name [package]四.关闭虚拟环境Linux: source deactivateWindows: deactivate五.删除虚拟环境conda remove -n your_env_name(虚拟环境名称) --allconda remove --name your_env_name package_name # 删除环境中的某个包
PYTHON几种常见获取帮助的方式
直接在执行命令窗口输入help()命令,可以连续的查询帮助文档。help()help> print也可以直接使用help(print)方式help(print)import tkinterprint(dir(tkinter))import tkinterprint(tkinter.__doc__)
Jupyter
在函数后面按入Shift+Tab组合键,查看对应的帮助文档
解决jupyter notebook无法找到虚拟环境的问题
1.首先进入到自己创建的虚拟环境(pytorch是虚拟环境的名字)activate pytorch2.在该环境下下载这个库conda install ipykernelconda install nb_conda#我查了很多博主的文章,大部分都是虚拟环境缺这两个库,可能是版本原因,我只缺少了nb_conda这个库,下载之后就成功了。3.打开jupyter notebook,我们就可以看到我们创建的虚拟环境pytorch了jupyter notebook
