mail perf tuning
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 3f953c1dc8c001b4bc110b9ebfc554efbb352066..a28d7b7e970a94cc580735002110a3ea675df1b4 100644 (file)
--- a/brc2
+++ b/brc2
@@ -1996,16 +1996,10 @@ capache()
 
 
 
-
-
-apache-apply() {
-  for file; do
-    if head -n1 "$file"| grep -E '^#!/bin/bash\b' &>/dev/null; then
-      {
-        head -n1 "$file"
-        # First paragraph is to avoid people being confused about why a
-        # file is apache licensed.
-        cat <<'EOF'
+apache-header() {
+  # First paragraph is to avoid people being confused about why a
+  # file is apache licensed.
+  cat <<'EOF'
 # 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
@@ -2028,14 +2022,41 @@ apache-apply() {
 # limitations under the License.
 
 EOF
+
+}
+
+# apply apache to git tracked bash files + README, except files with A?GPL3 header.
+apache-apply-repo() {
+  for f in $(git ls-files); do
+    [[ -L $f || ! -f $f ]] && continue
+    if [[ $f != README ]]; then
+      if ! grep -n '^#!/bin/bash' $f | grep ^1: &>/dev/null; then continue; fi
+      if  head -n 10 $f | grep 'it under the terms of the GNU General Public License as published by' &>/dev/null; then continue; fi
+    fi
+    apache-apply $f
+  done
+}
+
+apache-apply() {
+  for file; do
+    if head -n1 "$file"| grep -E '^#!/bin/bash\b' &>/dev/null; then
+      {
+        head -n1 "$file"
+        apache-header
         tail -n+2 "$file"
       } | sponge "$file"
+    else
+      {
+        apache-header
+        cat "$file"
+      } | sponge "$file"
     fi
   done
 }
+# strip out the apache license from a file.
 apache-strip() {
   for f in $(find . -type f -maxdepth 1); do if head -n1 "$f"| grep -E '^#!/bin/bash\b' &>/dev/null; then { head -n 20 $f | tac | sed '/^# limitations under the License.$/,/^# Copyright.*Ian Kelling$/d' | tac; tail -n+21 $f; } |sponge $f; fi ; done
-  }
+}
 
 chrome() {
   if type -p chromium &>/dev/null; then
@@ -2541,7 +2562,10 @@ ilog-local() {
     cd $d$n/"$chan"
     hr
     for x in *; do
-      echo $x; sed "s/^./${x%log}/" $x; hr;
+      # *** are parts and joins and such, and they make reading hard.
+      # I probably will want to see them sometimes, just have to
+      # remove that part.
+      echo $x; sed "s/^./${x%log}/;/\*\*\*/d" $x; hr;
     done
   done
 }
@@ -4486,7 +4510,7 @@ obs-gen-profiles() {
 # terminal clear. like clear, but put the prompt at the bottom,
 # useful for obs streaming the bottom half of a terminal window.
 tclear() {
-  for ((i=i; i<COLUMNS; i++)); do
+  for ((i=0; i<COLUMNS; i++)); do
     echo
   done
 }