随笔分类 - scripts
the scripts of works
摘要:一、场景 每天自动掘金签到 二、crontab工具 usage: crontab [-u user] file crontab [ -u user ] [ -i ] { -e | -l | -r } (default operation is replace, per 1003.2) -e (edi
阅读全文
摘要:1、通过CMD方式 在Windows中,凭据是指用户登录系统时的用户名和密码。在CMD中,可以使用cmdkey工具来添加、删除或更新凭据。 例如,要添加新的凭据以连接到远程资源,可以使用以下命令: cmdkey /add:TargetName /user:Username /pass:Passwor
阅读全文
摘要:1、场景 paramiko获取的字符串中有很多\x开头的字符,需要去除,获取原始输出 2、处理方法 content = "\x071cd\0x70" # 使用unicode-escape编码集,将unicode内存编码值直接存储,并替换空白字符 content = content.encode('u
阅读全文
摘要:1、ANSI Color及ANSI Escape ANSI Escape Codes · GitHub 2、处理ANSI Color # 7-bit and 8-bit C1 ANSI sequences ansi_escape_8bit = re.compile( br'(?:\x1B[@-Z\\
阅读全文
摘要:一、现象 就是项目代码更新需要手动编译生成一下相关proto的代码文件,然后windows下就一直报错,路径啥的也确认没问题 二、处理方法 使用WSL,使用ubuntu linux子系统进行生成 pip3 install grpcio grpcio-tools 然后再进行编译即可 参考链接: pyt
阅读全文
摘要:awk 是一款文本处理工具,可以使用它来分割字符串。以下是 awk 常用的字符串分割操作: 1、根据空格分割字符串 awk '{print $1,$2,$3}' filename.txt 这个命令会读取 filename.txt 文件中的每一行,然后将每一行按照空格分割成多个部分,并打印出前三段。
阅读全文
摘要:1、解决方法 pip install comtypes 参考链接: (88条消息) Windows下import pywifi库报错:ModuleNotFoundError: No module named ‘comtypes‘原因排查_广东上大分的博客-CSDN博客
阅读全文
摘要:一、场景 由于网上下载了个zip文件,想解压,发现需要密码,但是又忘记了下载的来源 二、方法 暴力破解:完全不知道密码是啥,只能以组合密码的方式进行遍历,如果知道可能得密码组合会快很多,如纯数字,纯字母等 字典破解:比如你知道可能得密码是多少,但是可能有很多种组合。 本质上都是对可能密码组合的遍历
阅读全文
摘要:1、C实现代码 Example of Client-Server Program in C (Using Sockets and TCP) | Programming Logic 2、问题 调试经验--缺少头文件导致的段错误 - 戴安澜式编程 - 博客园 (84条消息) 【C语言】warning:
阅读全文
摘要:1、 介绍 本文使用u2net, pillow, 及backgroundremover进行照片背景的替换 2、安装 pip install pillow pip install backgroundremover 3、u2net介绍 https://github.com/xuebinqin/U-2-
阅读全文
摘要:1、场景 我想实时输出当前系统时间,对比日志之间的时间差 2、方法 #!/bin/bash while(true) do echo $(date +%F%n%T) sleep 1 done 3、date命令参数 ~$ date --help Usage: date [OPTION]... [+FOR
阅读全文
摘要:1、起因 由于女友想看某网站付money视频,咱又不想充money,所以咱去网络上找在线解析的那种网站,下载下来,让其不用卡顿,不用手动复制黏贴,畅快的看视频 2、首先我们抓取电视剧的所有剧集链接 https://so.iqiyi.com/so/ 反正输入视频链接搜索就完了,然后拿到页面的url 然
阅读全文
摘要:1、m3u8库 https://pypi.org/project/m3u8/ 2、安装 pip install m3u8 3、使用 import time from Crypto.Util.Padding import pad from Crypto.Cipher import AES import
阅读全文
摘要:1、使用lsb_release -a ~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: foc
阅读全文
摘要:1、场景 由于测试需要删除缓存目录相关文件,但是rm -rf ./*的时候报错 2、处理方法 cd [需要删除的目录] ls | xargs -n 10 rm -fr ls 参数解释: 输出所有的文件名(用空格分割) xargs就是将ls的输出,每10个为一组(以空格为分隔符),作为rm -rf的参
阅读全文
摘要:1、官方文档 https://docs.python.org/3/library/concurrent.futures.html 2、安装 python 3.x中自带了concurrent.futures模块 python 2.7需要安装futures模块,使用命令pip install futur
阅读全文
摘要:1、场景 从接口读取数据写入文件时,在文件中显示的是Unicode字符 2、处理方法 import json def read_json_file(file_path): try: with open(file_path, mode='r', encoding='utf-8') as fp: res
阅读全文
摘要:1、场景 自动化测试中,需要将一些接口自动的写入到yaml中, 但是发现文件中显示的是Unicode字符 2、处理方法 import yaml def load_yaml_data(file_path): try: with open(file_path, 'r', encoding='utf-8'
阅读全文
摘要:1、国内各大yum源 阿里源 https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11G5ZGvj 2、备份本机yum源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/y
阅读全文
摘要:1、问题 python调用grpc接口报错 2、原因 由于更新了代码,proto文件没有重新build生成 3、重新build方法 python -m grpc_tools.protoc --python_out=./tools/ --grpc_python_out=./tools/ -I. ./p
阅读全文