From 502dd20c30178782554fb35f7dad1c232860f8a4 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 2 Apr 2022 13:30:17 +0200 Subject: add new-pad URL generator --- scripts/new-pad | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/new-pad (limited to 'scripts/new-pad') diff --git a/scripts/new-pad b/scripts/new-pad new file mode 100755 index 0000000..782eb36 --- /dev/null +++ b/scripts/new-pad @@ -0,0 +1,40 @@ +#!/bin/bash + +set -euE +trap 'bye $?' EXIT + +URL=https://pad.sigsum.org/p + +LETTERS="a-f" +NUMBERS="0-9" +GROUP_SEP="-" + +NUM_LETTERS=2 +NUM_NUMBERS=2 + +function main() { + group_num=$1; shift + + name="" + for i in `seq 1 $group_num`; do + name="$name$(new_group $LETTERS $NUM_LETTERS)" + name="$name$(new_group $NUMBERS $NUM_NUMBERS)" + name="$name$GROUP_SEP" + done + + echo $URL/${name::-${#GROUP_SEP}} +} + +function new_group() { + echo -n $(tr -dc $1 &2 + fi + + return $1 +} + +main $@ -- cgit v1.2.3