上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 31 下一页
摘要: #!/bin/bash bash_path=$(cd "$(dirname "$0")";pwd) source $bash_path/base.config echo "该脚本将会把" $serverA "机器上的" $document "目录同步到" $serverB "机器上"; read - 阅读全文
posted @ 2020-04-27 11:51 侃豺小哥 阅读(244) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash fileName=$1 now=`date +%Y%m%d%H%M` read -p "Are you sure delete the file or directory $1? yes|no: " input if [ $input == "yes" ] || [ $inp 阅读全文
posted @ 2020-04-27 11:46 侃豺小哥 阅读(256) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash #输入不同字符完成不同巡检内容 #打印提示符 HINT(){ read -p "请按回车继续:" } #查看CPU信息 CPU_INFO(){ echo echo -e "\033[4;31mPrint the CPU info:\033[0m" cat /proc/cpui 阅读全文
posted @ 2020-04-27 11:43 侃豺小哥 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash #显示菜单(单选) display_menu(){ local soft=$1 local prompt="which ${soft} you'd select: " eval local arr=(\${${soft}_arr[@]}) while true do echo 阅读全文
posted @ 2020-04-27 11:14 侃豺小哥 阅读(512) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash echo -e "\033[31m 这个是定时删除文件,获取更多工具及脚本请关注公众号: 波哥的IT人生 Please continue to enter or ctrl+C to cancel \033[0m" riqi=`date +%Y%m%d` #收件箱 EMAIL_ 阅读全文
posted @ 2020-04-27 09:25 侃豺小哥 阅读(1108) 评论(0) 推荐(0) 编辑
摘要: 背景 其实一开始用的是pymysql,但是发现维护比较麻烦,还存在代码注入的风险,所以就干脆直接用ORM框架。 ORM即Object Relational Mapper,可以简单理解为数据库表和Python类之间的映射,通过操作Python类,可以间接操作数据库。 Python的ORM框架比较出名的 阅读全文
posted @ 2020-04-26 18:23 侃豺小哥 阅读(404) 评论(0) 推荐(0) 编辑
摘要: 一、 collections 中 defaultdict 1.1 字典的键映射多个值 将下面的列表转成字典 l = [('a',2),('b',3),('a',1),('b',4),('a',3),('a',1),('b',3)] 一个字典就是一个键对应一个单值的映射,而上面的列表中有相同键。如果你 阅读全文
posted @ 2020-04-26 16:59 侃豺小哥 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 使用 django 开发项目时,如果你使用 model 模型管理你的数据库表,对 migrations 文件会很熟悉,每次 model 模型有新的变更都会执行 python manage.py makemigrations 这个命令, 生成一些操作数据表的 migrations 脚本文件,但是随着项 阅读全文
posted @ 2020-04-26 10:24 侃豺小哥 阅读(971) 评论(0) 推荐(0) 编辑
摘要: 1.安装expect yum -y install expect 2.创建iplist.txt文件(要分发的IP地址) 192.168.163.131 192.168.163.134 3.创建user.txt(里面包含密码) 3398986 3398986 4.创建脚本 test.sh,test.l 阅读全文
posted @ 2020-04-22 16:44 侃豺小哥 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 1. 最直观的相加 使用 + 对多个列表进行相加,你应该懂,不多说了。 >>> list01 = [1,2,3] >>> list02 = [4,5,6] >>> list03 = [7,8,9] >>> >>> list01 + list02 + list03 [1, 2, 3, 4, 5, 6, 阅读全文
posted @ 2020-04-16 09:26 侃豺小哥 阅读(2522) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 31 下一页