02 2020 档案
摘要:os.mkdir()创建单个不存在的空目录,无法创建多个或者已经存在的含有文件的同名目录 os.makedirs() 能够递归创建多个目录,如果目录已经存在即使都是空的或者目录已经存在且含有文件,则引发OS.Error异常 os.listdir() .枚举出当前目录下所有文件以及目录,仅针对当前层级
阅读全文
摘要:import os def local_rm(dirpath): if os.path.exists(dirpath): files = os.listdir(dirpath) for file in files: filepath = os.path.join(dirpath, file).rep
阅读全文
摘要:差集>>> #两个列表的差集3 >>> ret3 = list(set(a) ^ set(b)) #两个列表的差集 >>> ret4=list(set(a).difference(set(b))) # a not same b ,retrun = a-b if a-b>0 else {} 并集 获取
阅读全文
摘要:http://c.biancheng.net/view/1009.html
阅读全文
摘要:debug shell:执行 sh -x test.sh vi test.sh :set fileformat=unix :wq解决问题原因是我在windows pycharm 写的格式不符合unix导致语法错误
阅读全文
摘要:requirements.txt 包含paramiko,pysfp.setuptools,适用python版本3.6.6+ 前提编译安装python wget wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz tar -xvf
阅读全文
摘要:vi /etc/locale.conf 修改LANG="zh_CN.gbk" 最后执行source /etc/locale.conf 即可永久生效,下次登录,中文就不会乱码了。
阅读全文
摘要:首先密钥登陆远程的原理 client 端 将公钥放在远程机器authorized_keys: 使用 ssh-copy-id app@ip 接着在client机器生成密钥 使用ssh-keygen -t rsa 生成密钥对,id_rsa: 编写测试脚本: import paramiko hostnam
阅读全文
摘要:以上是关于进程池的使用,截下来开始介绍如何使用多进程,由于multiprocessing 实现比concurrent.futures 实现更加底层这里还是推荐大家使用concurrent.futures ThreadExecutor ,因为他有更加友好的封装 最后我要介绍一下进程之间还有一种通信的方
阅读全文
摘要:"""设计场景:timo先说一句,亚索再说一句timo: timo队长正在待命yasuo: 面对疾风吧timo: timo整装待发yasuo: 哈杀gay """我们最先想到就是使用Lock一人轮流说一句,看下效果: 实际下效果发现好像不一样: 那么如何控制他们按照合理的顺序去你说一句我回答一局好像
阅读全文
摘要:锁的引入: 我们查看官方文档:https://docs.python.org/3/library/threading.html#lock-objects 原语锁:threading.Lock 实现原始锁对象的类。一旦线程获取了锁,随后的尝试将其阻塞,直到释放为止。任何线程都可以释放它。 重入锁:th
阅读全文
摘要:1.认识GIL: 说到GIL一直是代码专家们一直以来想要解决的问题,也是被许多程序员诟病的,下面带领大家看下官方threading模块document中如何去描述对于GIL这个全局解释器锁的:https://docs.python.org/3/library/threading.html 全局解释器
阅读全文
摘要:查看源码: 这是一个线程控制的类,这个类可以被子类化(继承)在一定的条件限制下,这里有两种方式去明确活动:第一通过传入一个callable 对象也就是调用对象,一种是通过重写这个Thread类的run方法 def add(): pass print(callable(add))从的上面实现多线程方式
阅读全文
摘要:python 实现threadpool线程池管理: from concurrent.futures import ThreadPoolExecutor as te from concurrent.futures import ProcessPoolExecutor as pe from concur
阅读全文
摘要:from locust import HttpLocust, TaskSet, task import uuid, time import logging,json # https://docs.locust.io/en/stable/third-party-tools.html class Use
阅读全文
摘要:# coding=utf-8 # urllib_get_file=urllib.request.urlretrieve(url=None,filename="test.zip") # basic usage of urllib from urllib import request url = "ht
阅读全文
摘要:核心代码: for i in range(10): print('\r' + '>' * i, end='') 示例展示以搜狗输入法为例: import timeimport requestsimport osfor i in range(10): print('\r' + '>' * i, end
阅读全文
摘要:修改服务器源,避免长途跋涉到国外: 位置: vim /etc/yum.repos.d/CentOS-Base.repo aliyun地址: 设置aliyun的yum源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.co
阅读全文
摘要:使用过Ubuntu的道友们都知道,默认地址是乌班图的org 配置的,对于国内长途跋涉的各位高手来讲真是艰辛; 所以我们一般在安装的时候会先修改服务器源地址使用国内的比如ali,清华或者华为的 源文件地址默认在 /etc/apt/sources.list,当然如果你安装第三方的一般我们喜欢在/etc/
阅读全文
摘要:百度搜索搜狗输入ubuntu找到官网地址 下载deb包 sogoupinyin_2.3.1.0112_amd64.deb 上传 dkpkg -i sogoupinyin_2.3.1.0112_amd64.deb apt-get install -f 安装依赖 解决缺少依赖问题 输入中文验证问题 解决
阅读全文
摘要:解决超大jtl解析过慢时间过长问题: usage: java -jar jmeter-graph.jar jtl_path interval_time (单位:s) 10G文件分析测试示范如下,耗时208s: 下载地址:https://files.cnblogs.com/files/Sunshine
阅读全文
摘要:问题描述:jmeter执行稳定性测试时,因时间过长,导致jtl文件过大,生成html报告过程报内存溢出错误(增加内存配置也不能解决) 使用 jmeter -n -t test.jmx -l res.jtl -e -o out_24hourdir 出现文件jtl过大达到6g甚至更高运行24h后解析内存
阅读全文
摘要:先看yum install 的卸载: 第一列为我们要的包名: 那么要移除必须使用 yum list |grep collectd | awk '{print $1}' |xargs yum remove -y 拿到第一列验证: gold line how to remove rpm install
阅读全文
摘要:先说下使用apt installl 安装的包的卸载: apt-get remove: 卸载软件apt-get purge: 卸载软件和配置文件apt-get autoremove: 移除没有使用的依赖apt-get clean: 删除/var/cache/apt/archives/下的所有deb包a
阅读全文
摘要:1.install python setup.py install --record files.txt 2. uninstall 删除这些文件 cat files.txt | xargs rm -rf
阅读全文
摘要:拓展: cp 简化: c'p -rv /data/project/test {.txt,_bak.txt}
阅读全文
摘要:echo "上一次后台pid is $!"echo "当前进程pid is $$"echo "last command return code is :$?"echo "bash file name is $0"echo "all var is: $*"echo "var number is : $
阅读全文
摘要:先判断下docker安装情况本机: docker version which docker #####删除旧的版本##### Docker 的旧版本被称为 docker,docker.io 或 docker-engine 。如果已安装,请卸载它们: $ sudo apt-get remove doc
阅读全文
摘要:内网离线安装方法:先下载官方的visualcppbuildtools: <br href=http://go.microsoft.com/fwlink/?LinkId=691126 ><a>点击下载</a></br> 查看 help命令: 执行安装命令下载需要联网的依赖包,注意此操作在外网进行,会在
阅读全文
摘要:./configure --prefix= /usr/local/python3.6.6 make && make install prefix=/usr/local/python3.6.6 python 编译安装代码会在:/usr/local/python3.6.6/bin 下: 再看DESTDI
阅读全文
摘要:jvm区域总体分两类,heap区和非heap区。heap区又分: Eden Space(伊甸园)、Survivor Space(幸存者区)、Tenured Gen(老年代-养老区)。 非heap区又分:Code Cache(代码缓存区)、Perm Gen(永久代)、Jvm Stack(java虚拟机
阅读全文
摘要:jps 类的pid jstat 使用: jstat -gcutil pid 1000 //1000是毫秒是监控时间 jstat -gc pid 1s jstat -gcnew pid // 查看young区的gc jstat -gcold pid // old 区也就是 Tenured gen 终身
阅读全文
摘要:from win32com.client import constants, gencache# TODO pip install pywin32 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.comw
阅读全文
摘要:https://www.jianshu.com/p/c8ee39488d2a xshell测试非root用户,可以正常连接,但是root用户仍旧无法访问 解决方法:修改 /etc/ssh/sshd_config 文件把PermitRootLogin Prohibit-password 添加#注释掉
阅读全文
摘要:查找火狐详细内容: dpkg --get-selections |grep firefox 删除 sudo apt-get purge firefox*
阅读全文
摘要:下载ubuntugoogle官网:http://www.ubuntuchrome.com/ 我的是ubuntuLTS稳定版: 上传Ubuntu: 执行解压操作: sudo dpkg -i google-chrome-stable_current_amd64.deb ALT+F1桌面搜索:goo出现g
阅读全文
摘要:安装ssh 安装ssh apt-get install openssh-server 安装 yum: apt-get install yum 安装vim: apt install vim 安装net-tools实现ifconfig: apt install net-tools 实现ubuntu和wi
阅读全文
摘要:针对centos : 先检查下tcp port range 在合理范围内: cat /proc/sys/net/ipv4/ip_local_port_range 1024 65535 上述为centos合理范围,不合理作出修改 解决方法: 1. 调低端口释放后的等待时间, 默认为60s, 修改为15
阅读全文
摘要:https://blog.csdn.net/Andrewniu/article/details/88743846
阅读全文
摘要:1.注意:需要配置同一地区同一可用区的机器 才是一个局网 2 配置好hosts文件 vi /etc/hostnames 192.168.110.151 master 192.168.110.152 node1 192.168.110.153 node2 3 生成公钥私钥 三台机器同样操作 ssh-k
阅读全文