maozedong_quotes

原文地址:https://www.marxists.org/chinese/maozedong/marxist.org-chinese-mao-193708.htm

矛盾的特殊性

我们的教条主义者是懒汉,他们拒绝对于具体事物做任何艰苦的研究工作,他们把一般真理看成是凭空出现的东西,把它变成为人们所不能够捉摸的纯粹抽象的公式,完全否定了并且颠覆了这个人类认识真理的正常秩序。他们也不懂得人类认识的两个过程的互相联结——由特殊到一般,又由一般到特殊,他们完全不懂得马克思主义的认识论。

title: docker常用编辑操作命令
date: 2023-03-06 14:39:00
tags:

  • docker
  • images

categories:

  • docker

1. (批量)删除镜像的命令

1
$ docker rmi xxx

当镜像被容器使用的时候删除会失败,因此,需要先将容器删除

比如我们想要批量将所有处于’Exited’状态的容器删掉,则可以使用如下命令:

1
2
3
4
# 1、停止容器
$ docker stop $(docker ps -a | grep "Exited" | awk '{print $1 }')
# 2、删除容器
$ docker rm $(docker ps -a | grep "Exited" | awk '{print $1 }')

当我们想要将不再使用的镜像删掉的时候,或者仓库中有大量的REPOSITORY和TAG为none的镜像时,可以通过下面的命令将符合过滤条件的镜像批量删除:

1
2
# 批量删除满足条件的镜像
$ docker rmi $(docker images | grep "none" | awk '{print $3}')

在idea中自定义注释模板

intellij idea中设置自定义代码模板

首先,在自定义代码模板中新增快捷方式*,并选择触发按键为Enter

代码注释模板定义如下:

  • $description$:定义方法描述字段
  • $author$:定义方法作者
  • $date$:定义方法定义日期
  • $param$:定义方法参数,该参数需要使用自定义groovy脚本
  • $return$:定义方法返回值,该参数需要使用自定义groovy脚本
1
2
3
4
5
6
7
*
*
* @description $description$
* @author $author$
* @date $date$ $time$
$param$ $return$
*/

变量赋值:

1
description = ""
1
author = user()
1
date = time()
1
2
3
4
return = groovyScript("
def param=\"${_1}\";
if(param == \'\' || param == \'void\') return \'\';
return \' \\n * @return \' + param", methodReturnType())
1
2
3
4
5
6
7
8
9
param =  groovyScript("
def result='';
def params=\"${_1}\".replaceAll(\'[\\\\[|\\\\]|\\\\s]\', \'\').split(\',\').toList();
for(i = 0; i < params.size(); i++) {
if(params[i] == \'\') return \' \';
result+=\' * @param \' + params[i] + \' \' + params[i] + ((i < params.size() - 1) ? \' \\n\' : \' \')
};
return result", methodParameters())

java代码中敲入/**,按下Enter键即可看到自动生成的注释

1
2
3
4
5
6
7
8
9
/**
*
* @description
* @author pengkai
* @date 2022/02/22 下午7:33
* @param username username
* @param password password
* @return org.springframework.security.core.userdetails.UserDetails
*/

debian10国内镜像

国内使用debian 10的软件仓库地址

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
# Debian 10 buster

# 中科大源

deb http://mirrors.ustc.edu.cn/debian buster main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free

# deb-src http://mirrors.ustc.edu.cn/debian buster main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian buster-updates main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free
# deb-src http://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free

# 官方源

# deb http://deb.debian.org/debian buster main contrib non-free
# deb http://deb.debian.org/debian buster-updates main contrib non-free
# deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free

# deb-src http://deb.debian.org/debian buster main contrib non-free
# deb-src http://deb.debian.org/debian buster-updates main contrib non-free
# deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free

# 网易源

# deb http://mirrors.163.com/debian/ buster main non-free contrib
# deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
# deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
# deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

# deb-src http://mirrors.163.com/debian/ buster main non-free contrib
# deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
# deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib
# deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib

# 阿里云

# deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
# deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
# deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
# deb http://mirrors.aliyun.com/debian-security buster/updates main

# deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
# deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
# deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
# deb-src http://mirrors.aliyun.com/debian-security buster/updates main

debian包管理器使用手册

debian包的构成

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
# 列出deb包中的内容
$ ar t dpkg_1.19.7_amd64.deb
debian-binary
control.tar.gz
data.tar.xz
# 解压缩deb安装包
$ ar x dpkg_1.19.7_amd64.deb
$ ls
control.tar.gz data.tar.xz debian-binary dpkg_1.19.7_amd64.deb
# 查看data.tar.xz包中的文件列表,并选择只展示前面的16行
$ tar tJf data.tar.xz | head -n 16
./
./
./etc/
./etc/alternatives/
./etc/alternatives/README
./etc/cron.daily/
./etc/cron.daily/dpkg
./etc/dpkg/
./etc/dpkg/dpkg.cfg
./etc/dpkg/dpkg.cfg.d/
./etc/logrotate.d/
./etc/logrotate.d/alternatives
./etc/logrotate.d/dpkg
./sbin/
./sbin/start-stop-daemon
./usr/
./usr/bin/
# 查看control.tar.xz包中的内容
tar xJf control.tar.xz
./
./conffiles
./control
./md5sums
./postinst
./postrm
# 查看文件内容
cat debian-binary
2.0

由此可见,Debian的deb存档格式主要由三个文件组成:

  • debian-binary
    用来标识deb文件包的格式版本的文本文件,在Buster发行版中仍然是2.0。
  • control.tar.xz
    这个档案里面包含了所有的元信息,比如说包名和版本,以及一些安装之前或者中途或者之后的执行脚本。其中的一些元信息甚至允许包管理器工具根据包中列举出的文件是否已经安装或者有些文件是否已经被本地修改来决定能否安装或者卸载该软件。
  • data.tar.xz,data.tar.bz2,data.tar.gz
    这个档案中包含了所有将会从包中提取出来的文件,比如可执行文件,类库,文档等等。该档案可以使用不同的压缩格式,相应的,档案的名字也会根据压缩类型选择合适的后缀,比如xzbzip2gzip

    软件包元信息

APT工具

  • 查看系统所有已经安装好包和对应的版本
    1
    $ apt-show-versions

https://www.debian.org/doc/manuals/debian-handbook/apt.zh-cn.html
未完待续…

vimrc配置教程

基础配置

  • set nocompatible:设置为不兼容vi
  • filetype on:自动检测文件类型
  • filetype plugin on:自动加载插件
  • filetype indent on:自动缩进
  • syntax on:语法高亮
  • set nu:开启行号
  • set cursorline:高亮光标所在的当前行
  • set cursorcolumn:高亮光标所在的当前列
  • set shiftwidth=4:设置shift的宽度为4个空格
  • set tabstop=4:设置tab的宽度为4列
  • set expandtab:使用空格代替tab的缩进
  • set nobackup:不保存备份文件

开箱即用的vimrc配置

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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""               
"
" ██╗ ██╗██╗███╗ ███╗██████╗ ██████╗
" ██║ ██║██║████╗ ████║██╔══██╗██╔════╝
" ██║ ██║██║██╔████╔██║██████╔╝██║
" ╚██╗ ██╔╝██║██║╚██╔╝██║██╔══██╗██║
" ╚████╔╝ ██║██║ ╚═╝ ██║██║ ██║╚██████╗
" ╚═══╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Disable compatibility with vi which can cause unexpected issues.
set nocompatible

" Enable type file detection. Vim will be able to try to detect the type of file is use.
filetype on

" Enable plugins and load plugin for the detected file type.
filetype plugin on

" Load an indent file for the detected file type.
filetype indent on

" Turn syntax highlighting on.
syntax on

" Add numbers to the file.
set number

" Highlight cursor line underneath the cursor horizontally.
set cursorline

" Highlight cursor line underneath the cursor vertically.
set cursorcolumn

" Set shift width to 4 spaces.
set shiftwidth=4

" Set tab width to 4 columns.
set tabstop=4

" Use space characters instead of tabs.
set expandtab

" Do not save backup files.
set nobackup

" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=10

" Do not wrap lines. Allow long lines to extend as far as the line goes.
set nowrap

" While searching though a file incrementally highlight matching characters as you type.
set incsearch

" Ignore capital letters during search.
set ignorecase

" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase

" Show partial command you type in the last line of the screen.
set showcmd

" Show the mode you are on the last line.
set showmode

" Show matching words during a search.
set showmatch

" Use highlighting when doing a search.
set hlsearch

" Set the commands to save in history default number is 20.
set history=1000

" Enable auto completion menu after pressing TAB.
set wildmenu

" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest

" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx

" PLUGINS ---------------------------------------------------------------- {{{

call plug#begin('~/.vim/plugged')

Plug 'dense-analysis/ale'

Plug 'preservim/nerdtree'

call plug#end()

" }}}

" MAPPINGS --------------------------------------------------------------- {{{

" Set the backslash as the leader key.
let mapleader = "\"

" Press \\ to jump back to the last cursor position.
nnoremap <leader>\ ``

" Press \p to print the current file to the default printer from a Linux operating system.
" View available printers: lpstat -v
" Set default printer: lpoptions -d <printer_name>
" <silent> means do not display output.
nnoremap <silent> <leader>p :%w !lp<CR>

" Type jj to exit insert mode quickly.
inoremap jj <Esc>

" Press the space bar to type the : character in command mode.
nnoremap <space> :

" Pressing the letter o will open a new line below the current one.
" Exit insert mode after creating a new line above or below the current line.
nnoremap o o<esc>
nnoremap O O<esc>

" Center the cursor vertically when moving to the next word during a search.
nnoremap n nzz
nnoremap N Nzz

" Yank from cursor to the end of line.
nnoremap Y y$

" Map the F5 key to run a Python script inside Vim.
" We map F5 to a chain of commands here.
" :w saves the file.
" <CR> (carriage return) is like pressing the enter key.
" !clear runs the external clear screen command.
" !python3 % executes the current file with Python.
nnoremap <f5> :w <CR>:!clear <CR>:!python3 % <CR>

" You can split the window in Vim by typing :split or :vsplit.
" Navigate the split view easier by pressing CTRL+j, CTRL+k, CTRL+h, or CTRL+l.
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l

" Resize split windows using arrow keys by pressing:
" CTRL+UP, CTRL+DOWN, CTRL+LEFT, or CTRL+RIGHT.
noremap <c-up> <c-w>+
noremap <c-down> <c-w>-
noremap <c-left> <c-w>>
noremap <c-right> <c-w><

" NERDTree specific mappings.
" Map the F3 key to toggle NERDTree open and close.
nnoremap <F3> :NERDTreeToggle<cr>

" Have nerdtree ignore certain files and directories.
let NERDTreeIgnore=['\.git$', '\.jpg$', '\.mp4$', '\.ogg$', '\.iso$', '\.pdf$', '\.pyc$', '\.odt$', '\.png$', '\.gif$', '\.db$']

" }}}

" VIMSCRIPT -------------------------------------------------------------- {{{

" Enable the marker method of folding.
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END

" If the current file type is HTML, set indentation to 2 spaces.
autocmd Filetype html setlocal tabstop=2 shiftwidth=2 expandtab

" If Vim version is equal to or greater than 7.3 enable undofile.
" This allows you to undo changes to a file even after saving it.
if version >= 703
set undodir=~/.vim/backup
set undofile
set undoreload=10000
endif

" You can split a window into sections by typing `:split` or `:vsplit`.
" Display cursorline and cursorcolumn ONLY in active window.
augroup cursor_off
autocmd!
autocmd WinLeave * set nocursorline nocursorcolumn
autocmd WinEnter * set cursorline cursorcolumn
augroup END

" If GUI version of Vim is running set these options.
if has('gui_running')

" Set the background tone.
set background=dark

" Set the color scheme.
colorscheme molokai

" Set a custom font you have installed on your computer.
" Syntax: <font_name>\ <weight>\ <size>
set guifont=Monospace\ Regular\ 12

" Display more of the file by default.
" Hide the toolbar.
set guioptions-=T

" Hide the the left-side scroll bar.
set guioptions-=L

" Hide the the left-side scroll bar.
set guioptions-=r

" Hide the the menu bar.
set guioptions-=m

" Hide the the bottom scroll bar.
set guioptions-=b

" Map the F4 key to toggle the menu, toolbar, and scroll bar.
" <Bar> is the pipe character.
" <CR> is the enter key.
nnoremap <F4> :if &guioptions=~#'mTr'<Bar>
\set guioptions-=mTr<Bar>
\else<Bar>
\set guioptions+=mTr<Bar>
\endif<CR>

endif

" }}}

" STATUS LINE ------------------------------------------------------------ {{{

" 状态条当vimrc重新加载的时候
set statusline=

" 左侧的状态条
set statusline+=\ %F\ %M\ %Y\ %R

" 在左右边的中间部分添加分割条
set statusline+=%=

" 右侧的状态条
"set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%

" 在倒数第二行展示状态条
set laststatus=2

" }}}

参考资料:https://www.freecodecamp.org/news/vimrc-configuration-guide-customize-your-vim-editor/

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
" 设置一个tab等于4个空格
set shiftwidth=4
set tabstop=4
" 智能使用tab键
set smarttab
" 使用空格代替tab
set expandtab
" 打开行号
set nu
" 开启自动缩进
set ai
" 开启智能缩进
set si
" 开启自动换行
set wrap
" 开启语法高亮
syntax enable
" 高亮查询结果
set hlsearch
" 查询时,智能判定大小写
" set smartcase(会覆盖ignorecase)
" 查询时,忽略大小写
set ignorecase
" 显示文件名
set laststatus=2
if &compatible
" 如果处于兼容模式,则设为非兼容模式,否则保持默认设置
set nocompatible
endif

" 设置jj为esc的快捷键
inoremap jj <esc>

" 按需添加插件管理器
function! PackInit() abort
packadd minpac
call minpac#init()
call minpac#add('tpope/vim-scriptease',{'type':'opt'})
call minpac#add('k-takata/minpac',{'type':'opt'})
call minpac#add('plasticboy/vim-markdown')
endfunction
" 快捷键,实时更新插件、实时删除插件、实时查看插件状态
command! PackUpdate source $MYVIMRC | call PackInit() | call minpac#update()
command! PackClean source $MYVIMRC | call PackInit() | call minpac#clean()
command! PackStatus packadd minpac | call minpac#status()
command! PackList packadd minpac | call minpac#status()
nnoremap <C-p> :<C-u>FZF<CR>
nnoremap <C-s> :<C-u>w<CR>