Skip to content

Instantly share code, notes, and snippets.

@kobalab
Created August 25, 2026 10:55
Show Gist options
  • Select an option

  • Save kobalab/c8111746280c7f70f5efaed2017fe38b to your computer and use it in GitHub Desktop.

Select an option

Save kobalab/c8111746280c7f70f5efaed2017fe38b to your computer and use it in GitHub Desktop.
麻雀サーバーへの接続数集計をHTML化する
#!/bin/sh
test $1 && month=$1 || month=`date '+%Y-%m'`
echo Content-Type: text/html
echo
echo "<title>majiang-server log</title>"
echo "<style>"
echo "html, table { font-size: 14px; }"
echo "th, td { text-align: right; }"
echo "td { width: 2.5em; }"
echo "</style>"
echo "<h1>majiang-server log</h1>"
echo "<h2>$month</h2>"
echo "<table>"
echo "<tr><th>"`echo ' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23' | sed 's/ /<\/th><th>/g'`"</th></tr>"
cat $month.sum | sed 's/^.*\-//' | sed 's/: /<\/th><td>/' | \
sed 's/ /<\/td><td>/g' | sed 's/^/<tr><th>/' | sed 's/$/<\/td><\/tr>/'
echo "</table>"
next=`ls *.sum | sed '/^'$month'/,$d'| tail -1`
if [ $next ]
then
next=`echo $next | sed 's/\..*//'`
echo '<ul><li><a href="./?'$next'">'$next'</a></li></ul>'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment