From 9a80b1370485bfcd7f7f3ba9a9b417c753a6d205 Mon Sep 17 00:00:00 2001 From: fro Date: Fri, 31 Oct 2025 05:51:19 -0500 Subject: [PATCH] /+ decimal_to_base36() --- dots/bash/.bashrc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/dots/bash/.bashrc b/dots/bash/.bashrc index 355286f..d2848a2 100644 --- a/dots/bash/.bashrc +++ b/dots/bash/.bashrc @@ -344,6 +344,15 @@ ascii() { fi } +# https://boulderappsco.postach.io/post/convert-decimal-to-base-36-alpha-numeric-in-bash-linux +function decimal_to_base36(){ + BASE36=($(echo {0..9} {A..Z})); + arg1=$@; + for i in $(bc <<< "obase=36; $arg1"); do + echo -n ${BASE36[$(( 10#$i ))]} + done && echo +} + gpxImporter() { cd /home/poq/syncDir/gitRepos/gt.op.fo/gpx-importer/go/src/ go run main.go @@ -481,6 +490,10 @@ rotl() { } rote() { + rote36 $1 +} + +rote10() { if [[ -n $1 ]] ; then datestamp=$(date +%y%m%d)_ @@ -493,6 +506,28 @@ rote() { fi } +rote36() { + if [[ -n $1 ]] ; then + + datestamp=$(date +%y%m%d)_ + + year=$(decimal_to_base36 $(date +%y)) + month=$(decimal_to_base36 $(date +%m)) + day=$(decimal_to_base36 $(date +%d)) + + datestamp=${year}${month}${day}_ + datestamp=`echo "${datestamp}" | tr '[A-Z]' '[a-z]'` + rotl=$(rotl $1 0) + # ${param/pattern/replacement} + rotl="${rotl/./}" + emailaddress=$datestamp$rotl"@468910.xyz" + echo $emailaddress + + fi +} + + + # --- # mounting # ---