Linux Tools: ddate and cat/proc/*


Two new APIs are added: they are ddate and cat-proc.

cat-proc

cat-proc is actually not a linux commnad. It is short for cat /proc/* where * is the filename under folder /proc。 There are many information-related files you can output the contents. For example, uptime, cpuinfo, meminfo, filesystems etc. So you can output the file using API cat-proc with parameter file.

For example, https://helloacm.com/api/cat-proc/?file=cpuinfo

returns JSON-format string:

"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 is a fun date conversion tool from Gregorian dates to Discordian date. If no parameters given, it will assume today as current date. It can then have four parameters, +format, day, month, and year.

For example, https://helloacm.com/api/ddate/?d=1&m=1&y=2011

gives:

"Sweetmorn, Chaos 1, 3177 YOLD\n"

The page for this API is at: https://helloacm.com/ddate/

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
792 words
Last Post: WordPress Child Theme - The Only Things You Need to Know
Next Post: Crontab-Generator, Secure, Fast, Handy Tool to Generate the Crontab Lines

The Permanent URL is: Linux Tools: ddate and cat/proc/*

Leave a Reply