ubuntu使用shadowsocks

1
$sudo apt-get install privoxy

安装完后进行配置,其配置文件在/etc/privoxy/config
找到# forward-socks5t / 127.0.0.1:9050 .
把它改成 forward-socks5 / 127.0.0.1:1080 .
并且删掉前面的#注释,中间的t和结尾的9050改成1080
1.png
配置完成,重启privoxy:

1
$sudo /etc/init.d/privoxy restart

随后进入系统设置 -> 网络 -> 网络代理 -> 方法:手动 -> HTTP代理:127.0.0.1 8118
修改完成后点击应用到整个系统即可。
2.png

截图工具shutter的配置

安装:

1
$sudo apt-get install shutter

Ubuntu16.04设置方式

添加截图快捷键:
系统设置->键盘->快捷键->自定义快捷键
然后点击右侧禁用然后在键盘上输入快捷键即可


Ubuntu18.04设置方式

设置->设备->键盘->快捷键区域点击+号(拉到底部),设置名称,设置命令:shutter -s,设置键盘快捷键。

image-20210506221335573

dockerNote

常用命令:

查看运行中的容器:
1
docker ps
停止运行中的容器,可以使用容器名或容器ID
1
docker stop static_web
重新启动关闭的容器
1
docker start 容器ID/容器名
附着到正在运行的容器
1
docker attach 容器ID/容器名
从容器中构建镜像

查找需要导出镜像的容器

image-20210708181544821

1
docker commit -m "lrr第一次test" -a "lrr" 13f79514a41e  ufoym/deepo:pytorch-py36-cu100

运行结果:

image-20210708182252743

导出镜像:
1
docker save -o LRR/docker/my_deeplearning_01 5ee3ae62a0eb

查看结果:

image-20210708183802897

推送镜像到dockerHub

若在push过程中出现:denied: requested access to the resource is denied

则需要将镜像的用户名和dockerhub的用户名保持一致,可以用docker tag进行修改

1
docker push brooke921090271/static_web

结果:

image-20210708184918475

为镜像添加别名

第一个参数为源,第二个参数为别名

1
docker tag  lrr01/static_web:latest brooke921090271/static_web

docker复制文件到容器

第一个参数为本机路径,第二个参数为容器名/容器ID:容器中的路径

1
docker cp Linda3615_requirements.txt myexp2:/root/Linda3615_requirements.txt

为正在运行的容器启动另一个终端

若对正在运行的容器进行attach,会进入同一个终端

1
docker exec -it myexp2 /bin/bash

启动深度学习镜像

1
docker run -it --gpus all ufoym/deepo:pytorch-py36-cu100 /bin/bash

docker run 参数

Run a command in a new container

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG…]

  • -i:Keep STDIN open even if not attached,保证容器中STDIN是开启的
  • -t:Allocate a pseudo-TTY,分配为tty终端
  • --name:为容器分配名字

Example:

1
docker run -i -t ubuntu /bin/bash

开启以上两个参数才可以提供一个交互式的Shell

  • --gpus gpu-request: GPU devices to add to the container (‘all’ to pass all GPUs),这里可以用0,1,2选择

docker stop参数

Stop one or more running containers

Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

  • -t,Seconds to wait for stop before killing it (default 10),等待一段时间后杀死容器

docker commit 参数

Create a new image from a container’s changes

Usage: docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

  • -a:–author string
  • -m:–message string Commit message
  • -p:–pause Pause container during commit (default true)

docker save参数

Save one or more images to a tar archive (streamed to STDOUT by default)

  • -o:–output string Write to a file, instead of STDOUT

vim配置文件

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
set nocompatible              " required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
"call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
"Plugin 'gmarik/Vundle.vim'

" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
"Plugin 'Valloric/YouCompleteMe'


" All of your Plugins must be added before the following line
"call vundle#end() " required
filetype plugin indent on " required

syntax on "自动语法高亮
set number " 显示行号
set cursorline " 突出显示当前行
set ruler " 打开状态栏标尺
set shiftwidth=4 " 设定 << 和 >> 命令移动时的宽度为 4
set tabstop=4 " 设定 tab 长度为 4
filetype plugin indent on " 开启插件
set backupcopy=yes " 设置备份时的行为为覆盖
set nowrapscan " 禁止在搜索到文件两端时重新搜索
set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch " 搜索时高亮显示被找到的文本
set cmdheight=1 " 设定命令行的行数为 1
set laststatus=2 " 显示状态栏(默认值为 1, 无法显示状态栏)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set foldenable " 开始折叠
set foldmethod=syntax " 设置语法折叠
set foldcolumn=0 " 设置折叠区域的宽度
setlocal foldlevel=1 " 设置折叠层数为
" set foldclose=all " 设置为自动关闭折叠
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" 用空格键来开关折叠
" return OS type, eg: windows, or linux, mac, et.st..
function! MySys()
if has("win16") || has("win32") || has("win64") || has("win95")
return "windows"
elseif has("unix")
return "linux"
endif
endfunction

"highlight Functions
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
syn match cFunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi cFunctions gui=NONE cterm=bold ctermfg=blue

nmap <C-down> :resize +3<CR>
nmap <C-up> :resize -3<CR>
nmap <C-left> :vertical resize -3<CR>
nmap <C-right> :vertical resize +3<CR>
nmap <F5> :call RunTest()<CR>
nmap <F2> :call Save()<CR>
nmap <F3> :call Esc()<CR>
nnoremap <C-s> :call Save()<CR>
map <F9> :call Run()<CR>
func! RunTest()
exec "w"
exec "!./test.sh"
endfunc

func! Save()
exec"w"
endfunc

func! Esc()
exec "w"
exec "!clear"
exec "q"
endfunc

func! Run()
exec "w"
exec "!g++ -Wall -g % -o %<"
exec "! ./%<"
endfunc

" 当新建 .h .c .hpp .cpp .mk .sh等文件时自动调用SetTitle 函数
autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh exec ":call SetTitle()"

" 加入注释
func SetComment()
call setline(1,"/*================================================================")
call append(line("."), "* Copyright (C) ".strftime("%Y")." brooke. All rights reserved.")
call append(line(".")+1, "* ")
call append(line(".")+2, "* 文件名称:".expand("%:t"))
call append(line(".")+3, "* 创 建 者:Brooke")
call append(line(".")+4, "* 创建日期:".strftime("%Y年%m月%d日"))
call append(line(".")+5, "* 描 述:")
call append(line(".")+6, "*")
call append(line(".")+7, "================================================================*/")
call append(line(".")+8, "")
call append(line(".")+9, "")
endfunc

" 加入shell,Makefile注释
func SetComment_sh()
call setline(3, "#================================================================")
call setline(4, "# Copyright (C) ".strftime("%Y")." brooke. All rights reserved.")
call setline(5, "# ")
call setline(6, "# 文件名称:".expand("%:t"))
call setline(7, "# 创 建 者:Brooke")
call setline(8, "# 创建日期:".strftime("%Y年%m月%d日"))
call setline(9, "# 描 述:")
call setline(10, "#")
call setline(11, "#================================================================")
call setline(12, "")
call setline(13, "")
endfunc


" 定义函数SetTitle,自动插入文件头
func SetTitle()

if &filetype == 'make'
call setline(1,"")
call setline(2,"")
call SetComment_sh()

elseif &filetype == 'sh'
call setline(1,"#!/system/bin/sh")
call setline(2,"")
call SetComment_sh()

else
call SetComment()
if expand("%:e") == 'hpp'
call append(line(".")+10, "#ifndef _".toupper(expand("%:t:r"))."_H")
call append(line(".")+11, "#define _".toupper(expand("%:t:r"))."_H")
call append(line(".")+12, "#ifdef __cplusplus")
call append(line(".")+13, "extern \"C\"")
call append(line(".")+14, "{")
call append(line(".")+15, "#endif")
call append(line(".")+16, "")
call append(line(".")+17, "#ifdef __cplusplus")
call append(line(".")+18, "}")
call append(line(".")+19, "#endif")
call append(line(".")+20, "#endif //".toupper(expand("%:t:r"))."_H")

elseif expand("%:e") == 'h'
call append(line(".")+10, "#pragma once")

elseif &filetype == 'c'
call append(line(".")+10,"#include \"".expand("%:t:r").".h\"")

elseif &filetype == 'cpp'
call append(line(".")+10, "using namespace std;")
call append(line(".")+10, "#include \""."iostream\"")

endif

endif
endfunc

python2.7安装mysqldb

sudo pip install mysql-python
安装成功后,就可以中python中导入MySQLdb

关于pip install mysqlclient错误

使用django时安装mysqlclient模块出现“OsError:mysql_config not found”
python版本3.4.3,django版本1.11.7

解决方法:
sudo apt-get install libmysqlclient-dev python3-dev