- 它同时提供了结构化日志记录和printf风格的日志记录
- 它非常的快
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import hashlib | |
# 声明socket类型,同时生成socket连接对象 | |
# family默认是AF_INET,type默认是SOCK_STREAM,可以不用再写了 | |
client = socket.socket() | |
client.connect(("localhost", 55555)) # 连接的ip地址和端口号 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service salt-minion stop | |
rm -f /etc/salt/pki/minion/minion_master.pub | |
echo "master: salt" > /etc/salt/minion | |
service salt-minion start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 去除目录结构加上 --strip-components N | |
# 例如a.tar.gz,结构是 a/b/c/t.txt | |
tar -xzvf a.tar.gz --strip-components 1 # 结果就是 b/c/t.txt | |
# 解压到指定目录加 -C target_directory | |
tar -xzvf a.tar.gz -C dest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# 首先导入 db 对象以及待操作的模型 | |
from web_server import db | |
from web_server.models import ImageDsp | |
# 初始化表 如果是第一次运行的话 | |
db.create_all() | |
# 增 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find . -name *.sh | |
# 如果带查找目录存在多个后缀为 sh 的文件,则次命令会报如下错误: | |
# find: paths must precede expression: | |
# 因为通过shell展开后 -name 选项跟了过个带匹配的字符,所以报错 | |
# 解决方法是将带匹配的通配字符串用单引号或双引号括起来 | |
find . -name "*.sh" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
certutil -hashfile yourfilename.ext MD5 | |
certutil -hashfile yourfilename.ext SHA1 | |
certutil -hashfile yourfilename.ext SHA256 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 直接替换第一行为 hahaha | |
sed -i '1c hahaha' test.txt | |
# 直接替换第一道第二十行为 hahaha | |
sed -i '1,20c hahaha' test.txt | |
# 先查找包含aaa的行,然后整行替换为 hahaha | |
sed -i '/aaa/c hahaha' test.txt | |
# 先查找开头为aaa的行,然后整行替换为 hahaha | |
sed -i '/^aaa/c hahaha' test.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 利用ntpdate同步服务器时间 | |
sudo ntpdate -u <datetime server ip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!# 上一个命令名 | |
!$ 上一个命令的最后一个参数 | |
!:n 上一个命令的第n个参数 |
NewerOlder