Adding #nazi-simulator tag. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 36313f863031cd69bf602e01a775467c1a8f1897 DIR parent 4f4e1df23d5ffd15534295f6ee48d69a859e084e HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sat, 15 Jan 2022 20:20:15 +0100 Adding #nazi-simulator tag. Diffstat: A karma | 52 +++++++++++++++++++++++++++++++ M modules/hashtags/hashtags.txt | 1 + 2 files changed, 53 insertions(+), 0 deletions(-) --- DIR diff --git a/karma b/karma @@ -0,0 +1,52 @@ +#!/bin/sh + +karmamodbase="$HOME/bin/modules/karma" +karmadb="${karmamodbase}/karma.txt" + +function getkarmaval { + karmaval="$(grep "^$1" "${karmadb}" | cut -f 2)" + [ -z "${karmaval}" ] && printf "0\n" + printf "%s\n" "${karmaval}" +} + +function setkarmaval { + if [ -n "$(grep "^${1}" "${karmadb}")" ]; + then + sed -i "s,${1}\t.*,${1}\t${2}," "${karmadb}" + else + printf "%s\t%d\n" "${1}" "${2}" >> "${karmadb}" + fi +} + +function parsekarma { + printf "%s\n" "${1}" | sed -e 's,\(.*\)[+|-]\{2\}$,\1,' +} + +function modifykarma { + karmatag="$(parsekarma "$1")" + karmaval=$(getkarmaval "${karmatag}") + newkarmaval="$(printf "%d%s\n" "${karmaval}" "$2" | bc)" + setkarmaval "${karmatag}" $newkarmaval +} + +function inckarma { + modifykarma "$1" " + 1" +} + +function deckarma { + modifykarma "$1" " - 1" +} + +karmastr="$1" +case "${karmastr}" in +*++) + inckarma "${karmastr}" + ;; +*--) + deckarma "${karmastr}" + ;; +*) + sort -r -k 2 "${karmadb}" | column -t + ;; +esac + DIR diff --git a/modules/hashtags/hashtags.txt b/modules/hashtags/hashtags.txt @@ -7288,6 +7288,7 @@ #nature-rassertion gopher://bitreich.org/I/memecache/nature-rassertion.png #nazi gopher://bitreich.org/9/memecache/nazi.mkv #nazi-methods gopher://bitreich.org/9/memecache/nazi-methods.mkv +#nazi-simulator gopher://bitreich.org/I/memecache/nazi-simulator.jpg #nazi-thomas gopher://bitreich.org/9/memecache/nazi-thomas.webm #nazi-tip gopher://bitreich.org/I/memecache/nazi-tip.jpg #nazi-train gopher://bitreich.org/9/memecache/nazi-train.mp4