迁移分割线
在过去,这个BLOG由Publii构建且书写。现在转移到Hexo来进行构建,云端使用Vercel提供服务。面向未来的书写~!
Python UserAgent 库
Python UserAgent 库my-fake-useragent
https://pypi.org/project/my-fake-useragent/https://github.com/a358003542/my-fake-useragent
用处针对Useragent访问频次限制的站点,每次请求更换一个Useragent即可。
安装123pip install my_fake_useragent//python3pip3 install my_fake_useragent
特点提供浏览器定制,如Chrome、Edge,包括移动端
使用123from my_fake_useragent import UserAgentua = UserAgent(family='chrome')res = ua.random()
在限制Useragent的情况下,且长达数万频次的爬取中,程序顺利执行完毕。
CURL用法小记
输出状态码以及抛弃多余的信息1-w "%{http_code}\n" -o /dev/null
指定域名解析地址1--resolve *:443:${ip}
指定请求IP协议12--ipv4--ipv6
参数123-s 寂静模式 -I 只输出请求头信息-m 超时时间
-o /dev/null/dev/null是一个空设备,向其输出将抛弃这些数据。
开启Crontab日志
modify config1# vi /etc/rsyslog.conf
将
1#cron.* /var/log/cron.log
变为
1cron.* /var/log/cron.log
Restart service1# /etc/init.d/rsyslog restart
环境变量以及参考
https://www.cnblogs.com/yinkh/p/5757849.htmlhttps://www.cnblogs.com/grefr/p/6095013.html
scanf的用法专辑
C 库函数 - scanfscanf是格式输入函数,在使用scanf函数时要加上#include <stdio.h>,简单记录下基本用法。
scanf 类型说明符:
类型
合格的输入
参数的类型
%a、%A
读入一个浮点值(仅 C99 有效)。
float *
%c
单个字符:读取下一个字符。如果指定了一个不为 1 的宽度 width,函数会读取 width 个字符,并通过参数传递,把它们存储在数组中连续位置。在末尾不会追加空字符。
char *
%d
十进制整数:数字前面的 + 或 - 号是可选的。
int *
%e、%E、%f、%F、%g、%G
浮点数:包含了一个小数点、一个可选的前置符号 + 或 -、一个可选的后置字符 e 或 E,以及一个十进制数字。两个有效的实例 -732.103 和 7.12e4
float *
%lf
%lf代表双精度浮点型数据(double)。
double *
%i
读入十进制,八进制,十六进制整数 。
int *
%o
八进制整数。
int *
%s
字符串。这将读取连续字符,直到遇到一个空格字符(空 ...
Cpp Bitset
BitsetC++的 bitset 在 bitset 头文件中,它是一种类似数组的结构,它的每一个元素只能是0或1,每个元素仅用1bit空间。
12345678910111213141516171819202122232425262728293031323334353637383940414243bitset<4> bitset1; //无参构造,长度为4,默认每一位为0bitset<8> bitset2(12); //长度为8,二进制保存,前面用0补充string z = "100101";bitset<10> bitset3(z); //长度为10,前面用0补充char s2[] = "10101";bitset<13> bitset4(s2); //长度为13,前面用0补充cout << bitset1 << endl; //0000cout << bitset2 << endl; //00001100cout << bitset3 ...
Docker常用启动参数
Docker常用启动参数通过启动参数来创建Docker容器
-i “交互模式”运行容器
-t 容器启动后会进入其命令行
-d 创建一个守护式容器在后台运行(这样创建容器后不会自动登录容器,如果只加-i -t 两个参数,创建后就会自动进去容器)
–name 为容器命名
-p xx:xx 表示端口映射
–cpus=”x” 表示CPU限制
-m 400m 控制内存大小
-v /xx:/xx 映射存储卷
–dns 114.114.114.114 设置DNS
–restart=always 跟随容器启动
–network=host host网络
-e TZ=”Asia/Shanghai” 修改时区
–privileged=true 拥有写入权
实例创建Centos8docker run -i -t -d --name centos8 --cpus="3" -m 600m -p 30001:22 -p 30002:21 -p 30005:80 -p 30006:443 --restart=always - ...