/+ decimal_to_base36()

This commit is contained in:
fro
2025-10-31 05:51:19 -05:00
parent a97d03f1aa
commit 9a80b13704

View File

@@ -344,6 +344,15 @@ ascii() {
fi 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() { gpxImporter() {
cd /home/poq/syncDir/gitRepos/gt.op.fo/gpx-importer/go/src/ cd /home/poq/syncDir/gitRepos/gt.op.fo/gpx-importer/go/src/
go run main.go go run main.go
@@ -481,6 +490,10 @@ rotl() {
} }
rote() { rote() {
rote36 $1
}
rote10() {
if [[ -n $1 ]] ; then if [[ -n $1 ]] ; then
datestamp=$(date +%y%m%d)_ datestamp=$(date +%y%m%d)_
@@ -493,6 +506,28 @@ rote() {
fi 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 # mounting
# --- # ---