小赖子的英国生活和资讯

添加两 API: ddate 和 cat-proc

阅读 桌面完整版

添加 2 个API, ddate 和 cat-proc.

cat-proc

cat-proc 其实不是一个LINUX命令. 在文件夹 /proc 下有一些文件存储着一些系统相关的信息, 比如 uptime, cpuinfo, meminfo, filesystems 等. 用 cat 命令就可以把它们的内容输出出来.

比如通过 API, https://helloacm.com/api/cat-proc/?file=cpuinfo

返回 JSON 数据:

"processor\t: 0\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 44\nmodel name\t: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz\nstepping\t: 2\nmicrocode\t: 0x1\ncpu MHz\t\t: 2393.998\ncache size\t: 4096 KB\nphysical id\t: 0\nsiblings\t: 1\ncore id\t\t: 0\ncpu cores\t: 1\napicid\t\t: 0\ninitial apicid\t: 0\nfpu\t\t: yes\nfpu_exception\t: yes\ncpuid level\t: 11\nwp\t\t: yes\nflags\t\t: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb lm constant_tsc arch_perfmon nopl pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm\nbogomips\t: 4787.99\nclflush size\t: 64\ncache_alignment\t: 64\naddress sizes\t: 40 bits physical, 48 bits virtual\npower management:\n\nprocessor\t: 1\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 44\nmodel name\t: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz\nstepping\t: 2\nmicrocode\t: 0x1\ncpu MHz\t\t: 2393.998\ncache size\t: 4096 KB\nphysical id\t: 1\nsiblings\t: 1\ncore id\t\t: 0\ncpu cores\t: 1\napicid\t\t: 1\ninitial apicid\t: 1\nfpu\t\t: yes\nfpu_exception\t: yes\ncpuid level\t: 11\nwp\t\t: yes\nflags\t\t: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb lm constant_tsc arch_perfmon nopl pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm\nbogomips\t: 4787.99\nclflush size\t: 64\ncache_alignment\t: 64\naddress sizes\t: 40 bits physical, 48 bits virtual\npower management:\n\nprocessor\t: 2\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 44\nmodel name\t: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz\nstepping\t: 2\nmicrocode\t: 0x1\ncpu MHz\t\t: 2393.998\ncache size\t: 4096 KB\nphysical id\t: 2\nsiblings\t: 1\ncore id\t\t: 0\ncpu cores\t: 1\napicid\t\t: 2\ninitial apicid\t: 2\nfpu\t\t: yes\nfpu_exception\t: yes\ncpuid level\t: 11\nwp\t\t: yes\nflags\t\t: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb lm constant_tsc arch_perfmon nopl pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm\nbogomips\t: 4787.99\nclflush size\t: 64\ncache_alignment\t: 64\naddress sizes\t: 40 bits physical, 48 bits virtual\npower management:\n\nprocessor\t: 3\nvendor_id\t: GenuineIntel\ncpu family\t: 6\nmodel\t\t: 44\nmodel name\t: Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz\nstepping\t: 2\nmicrocode\t: 0x1\ncpu MHz\t\t: 2393.998\ncache size\t: 4096 KB\nphysical id\t: 3\nsiblings\t: 1\ncore id\t\t: 0\ncpu cores\t: 1\napicid\t\t: 3\ninitial apicid\t: 3\nfpu\t\t: yes\nfpu_exception\t: yes\ncpuid level\t: 11\nwp\t\t: yes\nflags\t\t: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb lm constant_tsc arch_perfmon nopl pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes hypervisor lahf_lm\nbogomips\t: 4787.99\nclflush size\t: 64\ncache_alignment\t: 64\naddress sizes\t: 40 bits physical, 48 bits virtual\npower management:\n\n"

ddate

ddate 是个好玩的日期转换命令 默认显示今天 可以支持 格式定义. 把阴阳日期转成 Discordian 日期.

比如 通过 API, https://helloacm.com/api/ddate/?d=1&m=1&y=2011

得到结果:

"Sweetmorn, Chaos 1, 3177 YOLD\n"

API 地址为: https://helloacm.com/ddate/

英文: https://helloacm.com/linux-tools-ddate-and-catproc/

强烈推荐

微信公众号: 小赖子的英国生活和资讯 JustYYUK

阅读 桌面完整版
Exit mobile version