Added code comments and did some cleanup.

This commit is contained in:
Johannes Findeisen 2024-05-21 10:50:04 +02:00
commit 411b040a11
2 changed files with 15 additions and 7 deletions

View file

@ -80,20 +80,29 @@ done
echo "Content-type: text/plain; charset=utf-8" echo "Content-type: text/plain; charset=utf-8"
echo "" echo ""
for VERSION in "6.9.${R_6_9}" "6.8.${R_6_8}" "6.6.${R_6_6}" "6.1.${R_6_1}" "5.15.${R_5_15}" "5.10.${R_5_10}" "5.4.${R_5_4}" "4.19.${R_4_19}" ; do for VERSION in "6.9.${R_6_9}" "6.8.${R_6_8}" "6.6.${R_6_6}" "6.1.${R_6_1}" "5.15.${R_5_15}" "5.10.${R_5_10}" "5.4.${R_5_4}" "4.19.${R_4_19}"; do
echo "<h2>Sum of all contributions from release $(echo ${VERSION} | cut -d "." -f1).$(echo ${VERSION} | cut -d "." -f2).1 to ${VERSION}</h2>" echo "<h2>Sum of all contributions from release $(echo ${VERSION} | cut -d "." -f1).$(echo ${VERSION} | cut -d "." -f2).1 to ${VERSION}</h2>"
echo "" echo ""
echo "<pre>" echo "<pre>"
cat {{ site.data_dir }}kernelstats/ChangeLog-$(echo ${VERSION} | cut -d "." -f1).$(echo ${VERSION} | cut -d "." -f2).* | \ cat {{ site.data_dir }}kernelstats/ChangeLog-$(echo ${VERSION} | cut -d "." -f1).$(echo ${VERSION} | cut -d "." -f2).* | \
# grep for all lines including the string "Author".
grep 'Author' | \ grep 'Author' | \
# Get the second field after the ":" delimiter.
cut -d':' -f2 | \ cut -d':' -f2 | \
# Sort all lines.
sort | \ sort | \
# Get uniq lines and prefix the count.
uniq -c | \ uniq -c | \
# Remove leading whitespaces and tabs.
sed 's/^[ \t]*//' | \ sed 's/^[ \t]*//' | \
# Numerically sort the lines.
sort -nr | \ sort -nr | \
# Get the top 50 lines.
head -n 50 | \ head -n 50 | \
sed 's@<@\&lt;@g' | \ # Replace "<" with "$lt;".
sed 's@>@\&gt;@g' sed 's/</\&lt;/g' | \
# Replace ">" with "$gt;".
sed 's/>/\&gt;/g'
echo "</pre>" echo "</pre>"
echo "" echo ""
done done

View file

@ -2,7 +2,7 @@
permalink: /cgi/lua/test.lua permalink: /cgi/lua/test.lua
--- ---
package.path = '{{ site.libdir }}/lua/?.lua;' .. package.path package.path = '{{ site.libdir }}/lua/?.lua;'..package.path
require('xw3.http') require('xw3.http')
@ -25,7 +25,7 @@ print(os.execute('/usr/bin/env | /usr/bin/sort'))
print() print()
--print(debug.traceback("Stack trace")) --print(debug.traceback("Stack trace"))
--print(debug.getinfo(1)) --print(debug.getinfo(1))
print('HTTP_COOKIE:') print('HTTP_COOKIES:')
print(os.getenv("HTTP_COOKIE")) print(os.getenv("HTTP_COOKIE"))
print() print()
@ -37,4 +37,3 @@ for k, v in pairs(cookies) do
print(k, v) print(k, v)
end end