使用hexo创建博客

  • 在github上新建一个以git账号为前缀的仓库,如shineniefei.github.io
  • 在本地工作目录,使用git克隆git clone git@github.com:shineniefei/shineniefei.github.io.git 把代码下到本地

阅读全文

mq python pika

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
#!/usr/bin/env python3
# coding:utf-8

import pika

username = 'username'
password = 'password'
host = '127.0.0.1'
port = 5672
vhost = '/vhost'
queue = 'request'
body = '{"type":null,"body":[{"contractNo":"111","masFlag":"N"}]}'

# parameters = pika.URLParameters(
# f'amqp://{username}:{password}@{host}:{port}/{vhost}')
credentials = pika.PlainCredentials(username, password)

parameters = pika.ConnectionParameters(
host=host, port=port, virtual_host=vhost, credentials=credentials)

properties = pika.spec.BasicProperties(content_type="text/plain")

conn = pika.BlockingConnection(parameters)

try:
with conn.channel() as chan:
# chan.queue_declare(queue=queue) # 声明一个队列
# chan.exchange_declare(exchange='CREDITHC_CS', exchange_type='direct')
chan.basic_publish(
exchange='',
routing_key=queue,
properties=properties,
body=body,
)
print(1)
except Exception:
raise
finally:
conn.close()

阅读全文

python3_algorithm_sort

1
2
3
4
5
6
7
8
9
def bubble_sort():
a_list = [2, 5, 7, 1, 4, 3, 6, 9, 8, 0]
if a_list:
for i in range(len(a_list) - 1): # 从零下标开始
for j in range(len(a_list) - i - 1):
if a_list[j] > a_list[j + 1]: # 左边大于右边的,交换位置
a_list[j], a_list[j + 1] = a_list[j + 1], a_list[j]
print(a_list)
return a_list

阅读全文

tools config vim vimrc

vimrc

windows下,打开gvim,使用:vi $vim/_vimrc打开配置文件:e $vim/_vimrc

阅读全文

windows 下安装 mongodb zip

下载mongodb zip版

https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.9.zip

阅读全文

tools config vscode User Settings

vscode 用户配置文件

windows下,配置python3,php,flake8,git等

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
{
"editor.fontFamily": "Consolas, monospace",
"editor.fontSize": 18,
"editor.detectIndentation": false,
"editor.renderControlCharacters": true,
"editor.renderWhitespace": "all",
"editor.tabSize": 4,
"editor.minimap.enabled": false,
"editor.wordWrap": "on",
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"git.path": "D:/IDE/PortableGit/bin/git.exe",
"git.autofetch": true,
"git.confirmSync": false,
"git.enableSmartCommit": true,
"git.autorefresh": true,
"php.validate.executablePath": "D:/IDE/php-5.6/php.exe",
"python.pythonPath": "D:/IDE/Python37/python.exe",
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "D:/IDE/Python37/Scripts/yapf.exe",
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "flake8",
"files.exclude": {
"**/__pycache__": true,
"**/.__pycache__": true,
"**/.pyc": true
},
"launch": {
"configurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Current File (console Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "internalConsole",
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
}
},
// ${workspaceRoot} the path of the folder opened in VS Code(VSCode中打开文件夹的路径)
// ${workspaceRootFolderName} the name of the folder opened in VS Code without any solidus (/)(VSCode中打开文件夹的路径, 但不包含"/")
// ${file} the current opened file(当前打开的文件)
// ${relativeFile} the current opened file relative to workspaceRoot(当前打开的文件,相对于workspaceRoot)
// ${fileBasename} the current opened file's basename(当前打开文件的文件名, 不含扩展名)
// ${fileDirname} the current opened file's dirname(当前打开文件的目录名)
// ${fileExtname} the current opened file's extension(当前打开文件的扩展名)
// ${cwd} the task runner's current working directory on startup()
// {
// "name": "Listen for XDebug",
// "type": "php",
// "request": "launch",
// "port": 9000
// },
// {
// "name": "Launch currently open script",
// "type": "php",
// "request": "launch",
// "program": "${file}",
// "cwd": "${fileDirname}",
// "port": 9000
// }
],
"compounds": []
},
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"python.jediEnabled": false,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"java.configuration.checkProjectSettingsExclusions": false,
}

阅读全文

linux ntp 配置

ntp server

  1. 检查安装,以下命令选一(默认应该会有,基本不用执行步骤1,2)

阅读全文

docker install

docker install

  1. Docker 要求系统的内核版本高于3.10

阅读全文

Linux install jenkins

docker install jenkins

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
docker pull jenkins/jenkins:lts

mkdir -p /var/jenkins_home
chmod -R 777 /var/jenkins_home
chown -R 1000:1000 /var/jenkins_home

mkdir -p /home/docker/jenkins/data
chmod -R 777 /home/docker/jenkins/data
chown -R 1000:1000 /home/docker/jenkins/data

# -d 后台 --name 名字 -p 外端口可修改和容器端口 -p -v 服务器目录和挂载目录 镜像名
docker run -d --name jenkins -p 8082:8080 -p 50000:50000 -v /home/docker/jenkins/data:/var/jenkins_home jenkins/jenkins:lts

docker logs jenkins
docker exec -t jenkins /bin/bash
# 权限问题查不了
cat /home/docker/jenkins/data/secrets/initialAdminPassword

docker images

docker ps

docker stop `CONTAINER ID`

docker rm jenkins

docker run -d --name jenkins -p 8082:8080 -p 50000:50000 -v /home/docker/jenkins/data:/var/jenkins_home jenkins/jenkins:lts

systemctl sop docker
rm -rf /var/bin/docker

阅读全文

linux ifcfg eth 配置

  1. cd /etc/sysconfig/network-scripts

  2. vi ifcfg-eth0

阅读全文