commit b0165e6caf72633ba7a186050125bbe77ba2ce0a
parent 59e34a3d2d178dae6ca575d3821bb47e061b8aa8
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Mon, 7 Oct 2019 16:38:21 +0200
Add Hiltjo's LoC and certificate check scripts
Diffstat:
2 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/.local/bin/checkcertdomains.sh b/.local/bin/checkcertdomains.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# check if certificate of domains expires in N days.
+
+#ISC License
+#
+#Copyright (c) 2011-2018 Hiltjo Posthuma <hiltjo@codemadness.org>
+#
+#Permission to use, copy, modify, and/or distribute this software for any
+#purpose with or without fee is hereby granted, provided that the above
+#copyright notice and this permission notice appear in all copies.
+#
+#THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+#WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+#MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+#ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+#WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+#ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+#OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+days=30
+end=$((3600*24*days))
+tmpfile=/tmp/checkcert_$$
+
+while read -r d; do
+ printf 'Checking %s... ' "$d"
+ printf '' | \
+ openssl s_client -no_ticket -tls1_2 \
+ -servername "$d" -connect "$d:443" > "$tmpfile" 2>/dev/null
+ openssl x509 -noout -checkend "$end" < "$tmpfile"
+ printf '\n%s: expires in %s days? %s\n' "$d" "$days" "$?"
+done << !__EOF__
+adamsgaard.dk
+www.adamsgaard.dk
+src.adamsgaard.dk
+andersdamsgaard.dk
+www.andersdamsgaard.dk
+andersdamsgaard.com
+www.andersdamsgaard.com
+!__EOF__
+
+rm -f "$tmpfile"
diff --git a/.local/bin/loc.sh b/.local/bin/loc.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# count (rough) LOC from a git repository.
+# writes to the files loc.csv and loc.png.
+
+#ISC License
+#
+#Copyright (c) 2011-2018 Hiltjo Posthuma <hiltjo@codemadness.org>
+#
+#Permission to use, copy, modify, and/or distribute this software for any
+#purpose with or without fee is hereby granted, provided that the above
+#copyright notice and this permission notice appear in all copies.
+#
+#THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+#WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+#MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+#ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+#WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+#ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+#OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# group by day
+git log --pretty='format:%H %cd' --date="format:%Y-%m-%d" | sort -k 2 | uniq -f 1 | while read -r commit date; do
+ printf '%s\t%s\t' "$date" "$commit"
+ git ls-tree --name-only -r "$commit" | grep -E 'Makefile|\.(c|h|sh|mk|cpp|cc|hh|js|css)$' | while read -r file; do
+ git show "$commit:$file" | wc -l
+ done | awk '{ l += int($0) } END { print l }'
+done | tee loc.csv
+
+# plot using GNU plot.
+
+gnuplot - <<__EOF__
+set term png
+set output "loc.png"
+
+set title "bloooat"
+set xlabel "Commit date"
+set ylabel "LOC"
+
+set xdata time
+set format x "%Y-%m"
+set timefmt "%Y-%m-%dT%H:%M:%S"
+
+set xtics 2592000
+set xtic rotate by 90 scale 0 right font ",8"
+plot 'loc.csv' using 1:3 with lp notitle pointtype 5 pointsize 0.3
+
+__EOF__
+
+xdg-open loc.png