原创 Docker支持多架構

Docker支持多架構 注:要求19.03以上版本(以下的不支持,Ubuntu 18.04的docker默認版本爲19.03) 創建支持多架構的docker image (加buildx命令) export DOCKER_CLI_EXPER

原创 Ubuntu 16.04搭建本地mirror軟件源(含16和14)

Ubuntu 16.04搭建本地mirror軟件源(含16和14): 參考網址(感謝作者):http://blog.csdn.net/fanwanli04/article/details/79622726 mkdir /space/mirr

原创 Gelara Load Balancer做負載均衡

Gelara Load Balancer做負載均衡: 安裝: yum install git libtool gcc-c++ git clone https://github.com/codership/glb cd glb/ ./boot

原创 python發送html格式的table數據(帶認證,587端口)

python發送html格式的table數據(帶認證,587端口) vi mailtable.py #!/usr/bin/python -- coding:UTF-8 -- import smtplibfrom email.mime.mul

原创 解決Ubuntu 18.04裏的docker不能正常DNS解析問題

解決Ubuntu 18.04裏的docker不能正常DNS解析問題: 注:替換Ubuntu 18.04默認的/etc/resolv.conf文件 mv /etc/resolv.conf /etc/resolv.conf.bak ln -s

原创 發放梯度獎金示例

發放梯度獎金示例: vi aa.py #!/usr/bin/python -,- coding:UTF-8 -- arr = [100000,60000,40000,20000,10000,0]rat = [0.01,0.015,0.03

原创 break和continue示例

break和continue示例: 注:break是停止,continue是跳過繼續 vi aa.py #!/usr/bin/python print("break------------------")count=0while count

原创 range使用示例

range使用示例: vi aa.py #!/usr/bin/python sum=0for i in range(1000):sum+=i print(sum) :wq python aa.py

原创 Ubuntu 18.04設置DNS

Ubuntu 18.04設置DNS: vi /etc/systemd/resolved.conf DNS= 10.0.0.3 10.0.0.4 :wq # systemctl restart systemd-resolved

原创 使用with打開文件

讀文件: with open("a.txt") as file:data = file.read() 寫文件: with open("a.txt") as f:f.write("hello")

原创 while循環示例

while循環示例: vi aa.py #!/usr/bin/python flag=Truewhile flag:input_str=input("please input something, 'q' for quit. ->")pri

原创 python函數def示例(計算梯形面積)

python函數def示例(計算梯形面積): vi aa.py #!/usr/bin/python def fun(a,b,h):s = (a+b)*h/2print s fun(3,4,5):wq python aa.py

原创 pt-heartbeat監測mysql主從同步延遲

pt-heartbeat監測mysql主從同步延遲: 安裝percona toolkit(pt-heartbeat爲該軟件的子命令): http://repo.percona.com/release/6/RPMS/x86_64/percon

原创 python知識學習

** 表示冥運算// 表示相除取整\ 表示轉義r" " 可用於避免轉義 用於將字符串相連字符串 * 數字表示覆制字符串個數變量[0] 表示變量裏的第1個,[1]爲第2個變量[-1] 表示變量裏的倒數第1個,[-2]爲倒數第2個endswi

原创 sysbench測試mysql性能

sysbench測試mysql性能: 安裝sysbench 1.0: apt-get install bzr automake libtool libmysqlclient-dev pkg-config unzip ln -s /usr/l