2023-03-31
编程语言
00

日期相关

  • 判断是否闰年
python
import calendar calendar.isleap(2024) # True
  • 打印某月日历
python
import calendar calendar.prmonth(2023,2)

image.png

  • 查询每月多少天
python
import calendar # 返回该月首日星期和天数 calendar.monthrange(2023,2) # (2,28)
2023-03-30
算法
00

读取数据

数组

队列

哈希

字符串

搜索

查找

2023-03-29
算法
00

读取数据

python
# 输入:3 4 5 a, b, c = list(map(int, input().split()))

特殊数值

python
# 无穷大 float('inf')
2023-03-27
Linux
00

简介

crontab命令是Unix和Linux用于设置周期性被执行的指令。该命令从标准输入设备读取指令,并将其存放于“crontab”文件中,以供之后读取和执行。crontab命令常见于 Unix 和 类Unix 的操作系统之中。通常,crontab储存的指令被守护进程激活, crond常常在后台运行,每一分钟检查是否有预定的作业需要执行。

该命令依赖于cron,可通过下面命令安装和启用:

bash
# 安装 sudo apt-get install cron # 启动 systemctl start cron # 查看状态 systemctl status cron
2023-03-27
Linux
00

常用服务管理命令

bash
# 重新载入服务 systemctl daemon-reload # 查看服务状态 systemctl status sshd # 启动服务 systemctl start sshd # 停止服务 systemctl stop sshd # 重启服务 systemctl restart sshd # 开机自启 systemctl enable sshd # 取消开机自启 systemctl disable sshd