unify dns related config, change some dns settings
[distro-setup] / easiest-to-type-numbers
diff --git a/easiest-to-type-numbers b/easiest-to-type-numbers
new file mode 100755 (executable)
index 0000000..279151f
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+source /a/bin/bash-bear-trap/bash-bear
+
+e () {
+    printf "%s\n" "$*"
+}
+
+
+prefix=$1
+suffix=$2
+
+# print number
+pn() {
+  for n; do
+    e $prefix$n$suffix
+  done
+}
+
+# level 1 numbers
+l1=(2 3 8 9)
+
+# level 2 numbers
+l2=(4 7)
+
+l12=( ${l1[@]} ${l2[@]} )
+
+t1() {
+
+  pn ${l1[@]}
+}
+
+t2() {
+
+  pn ${l2[@]}
+}
+
+declare -A used
+t3() {
+  for d1 in ${l1[@]}; do
+    for d2 in ${l1[@]}; do
+      if (( d1 == d2 )); then continue; fi
+      pn $d1$d2
+      used[$d1$d2]=t
+    done
+  done
+}
+
+t4() {
+  for d1 in ${l12[@]}; do
+    for d2 in ${l12[@]}; do
+      if (( d1 == d2 )); then continue; fi
+      if [[ ${used[$d1$d2]} ]]; then continue; fi
+      pn $d1$d2
+      used[$d1$d2]=t
+    done
+  done
+}
+
+for t in {1..4}; do
+  e tier $t
+  t$t
+done