摘要: #!/bin/bash for i in ${cat $1};do ipcalc -cs $i if [ $? -eq 0 ];then echo $i else echo "ip address inlegal" fi 阅读全文
posted @ 2019-08-31 12:50 啦啦啦嘻嘻嘻 阅读(1158) 评论(0) 推荐(0) 编辑
摘要: 1.先创建远程HOST的ip文件 例如:cat <<EOF>/home/test/ip.txt >10.1.1.1 >10.1.1.2 >10.1.1.3 >EOF 2.远程操作: ansible -i /home/test/ip.txt all -m shell -a "df -lh" -b -- 阅读全文
posted @ 2019-08-31 12:42 啦啦啦嘻嘻嘻 阅读(800) 评论(0) 推荐(0) 编辑
摘要: import re#自定义正则 rex="\'0000-00-00 00:00:00\'" new_str='now()' old_file_path=r'C:\Users\Ths\Desktop\test.txt' new_file_path=r'C:\Users\Ths\Desktop\newtest.txt' def match_timestamp(repex,eachline): ... 阅读全文
posted @ 2019-05-14 14:17 啦啦啦嘻嘻嘻 阅读(1580) 评论(0) 推荐(0) 编辑
摘要: netstat -ant|awk '/^tcp/{++state[$NF]};END{for(key in state)print key,state[key]}' 阅读全文
posted @ 2019-05-04 19:21 啦啦啦嘻嘻嘻 阅读(228) 评论(0) 推荐(0) 编辑
摘要: cat access.log |awk -F"-" '{print $1}'|sort -t $'.' -k 1n |uniq -c cat access.log |awk -F"-" '{print $1}'|sort -t $'.' -k 1nr |uniq -c 解析: -t '$'.' 指定 阅读全文
posted @ 2019-04-26 09:17 啦啦啦嘻嘻嘻 阅读(1790) 评论(0) 推荐(0) 编辑
摘要: 1.the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37 原因是nginx缺少http_ssl_module模块,编译安装时带上--with-http_ssl_module配置就 阅读全文
posted @ 2019-04-25 23:37 啦啦啦嘻嘻嘻 阅读(929) 评论(0) 推荐(0) 编辑
摘要: #json内容如下: root@localhost#cat test.txt #过滤命令如下: cat test2.txt |grep -vE '({|}|\[|\])'|cut -d: -f 2|sed ':a;N;$!ba;s/\n/ /g'|awk 'BEGIN{print"\n设置计数 器t 阅读全文
posted @ 2019-04-25 23:12 啦啦啦嘻嘻嘻 阅读(5119) 评论(0) 推荐(0) 编辑
摘要: #装饰器实现单例模式 def singleton1(func): instance={} def inner(*args,**kwargs): if func not in instance: instance[func]=func(*args,**kwargs) return instance[func] retur... 阅读全文
posted @ 2019-03-03 21:46 啦啦啦嘻嘻嘻 阅读(288) 评论(0) 推荐(0) 编辑
摘要: #__author:"Feng Lin" #date: 2018/8/30 #装饰器进阶 # functool.wraps # 带参数的装饰器 # 多个装饰器装饰同一个函数 from functools import wraps #给装饰器添加特别的装饰器 print('###不加wraps,用__name__和__doc__等方法无法获取原函数,而是获取的闭包返回的inner##... 阅读全文
posted @ 2018-09-04 10:34 啦啦啦嘻嘻嘻 阅读(156) 评论(0) 推荐(0) 编辑
摘要: #__author:"Feng Lin" #date: 2018/8/29 #装饰器:在不修改函数的调用方式,但是还是想在原来的函数前后添加功能 #如下:timer 就是一个装饰器函数,支队一个函数有一些装饰作用 #使用闭包是实现装饰器的基本原理 import time # def func(): # time.sleep(0.01) # print("哈哈嘿嘿") # def ... 阅读全文
posted @ 2018-08-29 18:48 啦啦啦嘻嘻嘻 阅读(153) 评论(0) 推荐(0) 编辑