Markdown

段内换行

在一行的结尾插入两个或以上的空格

链接地址

链接和文字分开,例如google,baidu

1
2
3
4
[google],[baidu]

[google]:https://www.google.com
[baidu]:https://www.baidu.com

网址链接

用<>包围,例如1234@qq.com(GFM拓展语法可以自动识别,不需要用<>)

1
<1234@qq.com>

表情符号

  • :smile:: :smile:
  • :laughing:: :laughing:

表格

左对齐 居中对齐 右对齐
01 hello a
02 world b
1
2
3
4
| 左对齐 | 居中对齐 | 右对齐 |
| :--- | :--: | ---: |
| 01 | hello | a |
| 02 | world | b |

任务列表

  • [x] 已完成
  • [ ] 未完成
1
2
- [x] 已完成
- [ ] 未完成

锚点

1
- [tips-markdown](#tips-markdown)

拓展

  • 幻灯片:reveal.js
  • 写书:GitBook
  • 写邮件:MarkDown Here(浏览器插件)
  • vscode插件
    • Markdown Preview Pro:增加渲染功能
    • Markdown All in One:方便写作

MySql

数据库命令

1
2
3
4
5
6
7
8
9
10
# 创建数据库
create database database-name;
# 查看所有数据库
show databases;
# 查看数据库信息
show create database database-name;
# 删除数据库
drop database database-name;
# 使用数据库
use database-name;

数据表命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 创建数据表
# PRIMARY KEY 主键约束,用于唯一标识对应的记录
# FOREIGN KEY 外键约束
# NOT NULL 非空约束
# UNIQUE 唯一性约束
# DEFAULT 默认值约束,用于设置字段的默认值
create table table-name(
id int(11),
name varchar(20),
age int(11)
);
# 查看所有数据表
show tables;
# 查看数据表信息(表格)
desc table-name;
# 查看数据表信息(按照创建语句展示)
show create table table-name;
# 添加字段
alter table table-name add field-name field-type;
# 删除字段
alter table table-name drop field-name;
# 删除数据表
drop table table-name;

NVM

Windows安装

地址

Ubuntu Install

1
2
3
4
sudo apt-get update
sudo apt-get install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc

常用命令

1
2
3
4
5
6
# 显示可用的nodejs版本
nvm list [available]
# 安装nodejs版本
nvm install version
# 切换nodejs版本
nvm use version

NPM

设置镜像仓库

npm install --registry=https://registry.npmmirror.com


Tmux

Tmux基本命令

1
2
3
4
5
# 进入Tmux窗口
tmux
# 退出(并杀死当前会话/窗口/窗格)
exit
Ctrl+D

会话命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 新建会话
tmux new # session-name: 0,1,2...
tmux new -s session-name
# 离开会话
tmux detach # ctrl+b d
# 进入会话
tmux attach -t session-name
# 切换会话
tmux switch -t session-name
# 列出所有会话
tmux ls # ctrl+b s
# 杀死会话
tmux kill-session -t <session-name>
# 重命名会话
tmux rename-session -t session-name new-session-name # ctrl+b $

窗口命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 新建窗口
tmux new-window # ctrl+b c
tmux new-window -n window-name
# 切换窗口
tmux select-window -t window-name
# 为当前窗口重命名
tmux rename-window new-name # ctrl+b ,
# 切换到前/后一个窗口
ctrl+b p/n
# 切换到指定编号的窗口
ctrl+b number
# 从列表中选择窗口
ctrl+b w

窗格命令

一个窗口可以有多个窗格

1
2
3
4
5
6
7
8
9
# 划分上下两个窗格
$ tmux split-window # ctrl+b "
# 划分左右两个窗格
$ tmux split-window -h # ctrl+b %
# 光标切换到上方/下方/左边/右边窗格
$ tmux select-pane -U/D/L/R # ctrl+b ↑/↓/←/→
# 当前窗格前移/后移(交换)
$ tmux swap-pane -U/D # ctrl+b {/}

Ctrl+B命令

按下Ctrl+B后,再按下其它按键触发的快捷键

C-b ?显示如下帮助信息

所有快捷键帮助信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
C-b C-b     Send the prefix key                                                                                                                                                                                                  [70/70]
C-b C-o Rotate through the panes
C-b C-z Suspend the current client
C-b Space Select next layout
C-b ! Break pane to a new window
C-b " Split window vertically
C-b # List all paste buffers
C-b $ Rename current session
C-b % Split window horizontally
C-b & Kill current window
C-b ' Prompt for window index to select
C-b ( Switch to previous client
C-b ) Switch to next client
C-b , Rename current window [57/70]
C-b - Delete the most recent paste buffer
C-b . Move the current window
C-b / Describe key binding
C-b 0 Select window 0
C-b 1 Select window 1
C-b 2 Select window 2
C-b : Prompt for a command [43/70]
C-b ; Move to the previously active pane
C-b = Choose a paste buffer from a list
C-b ? List key bindings
C-b C Customize options
C-b D Choose a client from a list
C-b E Spread panes out evenly
C-b L Switch to the last client
C-b M Clear the marked pane
C-b [ Enter copy mode
C-b ] Paste the most recent paste buffer
C-b c Create a new window
C-b d Detach the current client
C-b f Search for a pane [30/70]
C-b i Display window information
C-b l Select the previously current window
C-b m Toggle the marked pane
C-b n Select the next window
C-b o Select the next pane
C-b p Select the previous window
C-b q Display pane numbers
C-b r Redraw the current client
C-b s Choose a session from a list
C-b t Show a clock
C-b w Choose a window from a list
C-b x Kill the active pane
C-b z Zoom the active pane [17/70]
C-b { Swap the active pane with the pane above
C-b } Swap the active pane with the pane below
C-b ~ Show messages
C-b DC Reset so the visible part of the window follows the cursor
C-b PPage Enter copy mode and scroll up
C-b Up Select the pane above the active pane
C-b Down Select the pane below the active pane
C-b Left Select the pane to the left of the active pane
C-b Right Select the pane to the right of the active pane
C-b M-1 Set the even-horizontal layout
C-b M-2 Set the even-vertical layout
C-b M-3 Set the main-horizontal layout
C-b M-4 Set the main-vertical layout [4/70]
C-b M-5 Select the tiled layout
C-b M-n Select the next window with an alert
C-b M-o Rotate through the panes in reverse
C-b M-p Select the previous window with an alert
C-b M-Up Resize the pane up by 5
C-b M-Down Resize the pane down by 5
C-b M-Left Resize the pane left by 5
C-b M-Right Resize the pane right by 5
C-b C-Up Resize the pane up
C-b C-Down Resize the pane down
C-b C-Left Resize the pane left
C-b C-Right Resize the pane right
C-b S-Up Move the visible part of the window up
C-b S-Down Move the visible part of the window down
C-b S-Left Move the visible part of the window left
C-b S-Right Move the visible part of the window right

VSCode

从JetBrains转战vscode了,顺便记录一下遇到的问题和常用的技巧

vscode连接远程服务器

可以直接安装这个插件整合包:Remote Development

接着使用ctrl+shift+p,键入remote-ssh相关命令就可以连接远程了

但是我遇到了问题:“过程试图写入的管道不存在”,解决方法:

  1. 使用管理员方式打开vscode
  2. 清空C:\Users\用户名\.ssh目录下的内容
  3. 连接的时候,记得立刻输入密码(如果报错就retry,继续输入密码连接)

Sublime

快捷键

  • ctrl+shift+p: 打开万能搜索框

插件

  • terminus: 内嵌的terminal命令行,有panel和tab两种模式

key-map

1
2
3
4
5
6
[
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["alt+q"], "command": "next_view_in_stack" },
{ "keys": ["alt+shift+q"], "command": "prev_view_in_stack" },
]

Maven

生命周期

仅列举主要的阶段

  • default lifecycle
    • validate: validate the project is correct and all necessary information is available
    • compile: compile the source code of the project
    • test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
    • package: take the compiled code and package it in its distributable format, such as a JAR.
    • integration-test: process and deploy the package if necessary into an environment where integration tests can be run
    • verify: run any checks to verify the package is valid and meets quality criteria
    • install: install the package into the local repository, for use as a dependency in other projects locally
    • deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
  • clean lifecycle: cleans up artifacts created by prior builds
  • site lifecycle: generates site documentation for this project