摘要: 中文iso8859-1编码转utf8编码 str.encode("gbk").decode('gbk').encode('utf-8') 原理: utf8编码的文本可以用iso8859-1的编码表示,但是反过来不行。iso8859-1是单字节编码,而utf8是定长编码,从utf8转化成iso8859 阅读全文
posted @ 2018-04-10 11:08 in_the_way 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1. 在 setting.py 中添加 : 阅读全文
posted @ 2018-02-24 17:03 in_the_way 阅读(755) 评论(0) 推荐(0) 编辑
摘要: pool = redis.ConnectionPool(host='localhost', port=6379, decode_responses=True)r = redis.Redis(connection_pool=pool)r.lrem('key', 1, 'value') # 删除链表 k 阅读全文
posted @ 2018-02-11 16:20 in_the_way 阅读(292) 评论(0) 推荐(0) 编辑
摘要: */1 * * * * cd /data/application/cmdb_test/script && python sync_user.py > /home/deploy/cmdb.log # 每分钟执行一次,sync_user.py 问题是:cd /data/application/cmdb_ 阅读全文
posted @ 2018-02-08 17:01 in_the_way 阅读(154) 评论(0) 推荐(0) 编辑
摘要: ssh root@%s -o ConnectTimeout=2 "ssh root@%s ConnectTimeout=2 "if [ ! -d /root/scripts ]; then mkdir /root/scripts; fi"" # 有语法错误 改变思路:(mkdir -p 参数) ss 阅读全文
posted @ 2018-02-07 16:38 in_the_way 阅读(2085) 评论(0) 推荐(0) 编辑
摘要: 1.要出始化添加时的多选框,不能使用 row[],要 用两次 http 请求 2.要对某一列进行特殊处理,就对某一列 做一个 formatter 3.降低进程数,可以降低 cpu的使用率 4.健康检查的接口的 crvf 防攻击问题,返回json字符串 阅读全文
posted @ 2017-08-09 08:47 in_the_way 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 1.块状显示 2.下拉框单选 3.复选下拉框 4.idc 弹框 5.select的默认选项 阅读全文
posted @ 2017-08-08 08:51 in_the_way 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 1.利用 ansible 自动化工具,获取相应主机的信息 (1) 调用接口得到相应的 ip 链表 (http 协议) (2)调用 ansible python api 利用 ssh 协议获取相应ip的网络信息,系统信息(json 解析数据) 1 class MyInventory(Inventory 阅读全文
posted @ 2017-08-07 23:46 in_the_way 阅读(362) 评论(0) 推荐(0) 编辑
摘要: find find是最常见和最强大的查找命令,在磁盘中查找文件,用它找到任何你想找的文件,就是速度有点慢。 find path -option [ -print ] [ -exec -ok command ] {} \; path是文件的路径,option 是各个参数,[]中内容是附加项可有可无; 阅读全文
posted @ 2016-05-23 17:44 in_the_way 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 堆排序 堆排序: template<class T> void _AdjustDown(T* arr, size_t size, size_t index) { size_t child = index * 2 + 1; while (child < size) { if (child + 1 < 阅读全文
posted @ 2016-05-16 10:34 in_the_way 阅读(414) 评论(0) 推荐(0) 编辑