如果要使用DVD/ISO安装文件作为yum源,可以移步:https://blog.terrynow.com/2021/06/04/centos-how-to-mount-dvd-or-iso-to-yum-repository/ 手头有一些比较老的CentOS6系统,因为要mount nfs需要安装nfs-utils,所以尝试安装: yum install nfs-utils 发现yum install已经无法安装,因为CentOS6官方不再维护了 这种情况,其实可以找非官方(一般国内一些高校、阿里云等都有Cent…

2021-05-18 0条评论 1524点热度 0人点赞 admin 阅读全文

今天项目中需要用到一个JSON的依赖包(json-lib) 虽然根据https://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4查到pom应该这样导入: <!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib --> <dependency> <groupId>net.sf.json-lib</groupId> <artif…

2021-05-17 0条评论 2514点热度 0人点赞 admin 阅读全文

假设我们在局域网里的某台Windows电脑(192.168.1.1)设置了共享文件夹(share),需要MacOS电脑也能查看这个共享文件夹 方法很简单,打开Finder(访达)->前往(Go)->连接到服务器(Connect to Server)(或者执行快捷键⌘+K) 在接下来的输入框中,输入要连接的服务器(格式接下来介绍) 然后会要求输入用户名和密码,根据实际情况输入用户名密码,或者是否让keychain记住密码。 最简单是: smb://IPOrDNSName/sharename 如:smb:/…

2021-05-16 0条评论 1870点热度 0人点赞 admin 阅读全文

strptime可以根据特定的格式化的时间格式,将文本解析成datetime类型。 datetime格式化的日期时间格式,可以参考:https://blog.terrynow.com/2021/05/13/python-strftime-format-datetime-force-with-locale-string/ from datetime import datetime date_string1 = "2021-05-15" date_string2 = "2021-05-15 18:08" print("…

2021-05-15 0条评论 1394点热度 0人点赞 admin 阅读全文

今天新装的一台机器,需要安装vnstat做流量统计和监控,关于vnstat的介绍和安装,详见我的博客:https://blog.terrynow.com/2021/04/12/linux-network-monitor-tool-vnstat/ 在启动vnstat后(systemctl start vnstat),发现vnstat的状态是启动失败(systemctl status vnstat),错误信息如下: ExecStart=/usr/sbin/vnstatd -n (code=exited, status=…

2021-05-14 0条评论 2006点热度 0人点赞 admin 阅读全文

strftime是Python里将日期、时间格式化的一个工具方法 下面的代码片段将datetime转换成格式化后的string from datetime import datetime now = datetime.now() # 当前日期 year = now.strftime("%Y") print("年份:", year) month = now.strftime("%m") print("月份:", month) day = now.strftime("%d") print("天:", day) prin…

2021-05-13 0条评论 3179点热度 0人点赞 admin 阅读全文

最近一个项目中Java中用OKHttp/HttpsURLConnection请求一个https的API,出现如下报错: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target 用Postman或者浏览器模拟请求,却是正常的,也不是网上查到的所谓的证书问题。 因为实在检查不出来什么原…

2021-05-12 0条评论 3632点热度 0人点赞 admin 阅读全文

Python实际开发中用到的读写ini格式的配置文件, Python中的配置文件(ini/conf)格式要求还是比较严格的,如下: config.cfg: # [Main] 必须包含section # Section下面才能写key=value [Main] key1 = value1 key2 = value2 [Another Section] key3 = value3 下面记录下常用读写conf配置文件的代码 import configparser config = configparser.RawConf…

2021-05-11 0条评论 1809点热度 0人点赞 admin 阅读全文

给Linux(CentOS/Ubuntu)添加了一块新硬盘,下面介绍下,如何在Linux下查看新添加的硬盘,分区格式化、以及挂载到现有的文件系统中。 插上新硬盘(如果是vmware虚拟机,添加硬盘后开机,如果是云服务器,只要在后台把新买的硬盘关联到ECS虚拟机上,有需要的话,重启下ECS虚拟机) 运行fdisk -l [root@ecs-587c ~]fdisk -l ## 这里是查看目前系统上有几块硬盘 Disk /dev/sda: 36.4 GB, 36401479680 bytes 255 heads, 63…

2021-05-10 0条评论 2992点热度 0人点赞 admin 阅读全文

Python中String没有类似Java里的contains,不过可以使用string.find返回找到的下标来判断是否包含字符串: source_string = 'abc' contains_string = 'a' founded_index = source_string.find(contains_string) # 找到返回>=0 找不到返回-1 print(founded_index >= 0) # 根据找到的index判断是否包含字符串 不过有个问题,如果我们要不要判断大小写呢(大小写…

2021-05-09 0条评论 4258点热度 0人点赞 admin 阅读全文
1686970717286