Added scripts.

Pascal J. Bourguignon [2021-10-19 14:20]
Added scripts.
Filename
agcc
allhosts
cycle-patchwork-errors
gcc-include-directories
gcc-warnings.lisp
git-find-file
idle
macosx-ldd
sq11-timerset
tb
wget-nc
diff --git a/agcc b/agcc
new file mode 100755
index 0000000..0ea46c6
--- /dev/null
+++ b/agcc
@@ -0,0 +1,6 @@
+#!/bin/bash
+exec gcc \
+     "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" \
+     "-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib" \
+     "$@"
+
diff --git a/allhosts b/allhosts
index e380dc4..1fd962f 100755
--- a/allhosts
+++ b/allhosts
@@ -3,10 +3,10 @@ pname=$(basename "$0")
 verbose=1

 HOSTS=(
+    proteus.sbde.fr
     hubble.informatimago.com
-    proteus.informatimago.com
-    despina.lan.informatimago.com
     kuiper.lan.informatimago.com
+    despina.lan.informatimago.com
     larissa.lan.informatimago.com
     # lassell.lan.informatimago.com
     # galatea.lan.informatimago.com
@@ -50,61 +50,7 @@ function hostheader(){
 }


-script=""
-command=()
-while [ $# -gt 0 ] ; do
-    case "$1" in
-    -s)
-        verbose=0
-        shift
-        ;;
-    -h)
-        verbose=1
-        shift
-        ;;
-    -v)
-        verbose=2
-        shift
-        ;;
-    -f)
-        shift
-        script="$1"
-        shift
-        ;;
-    -*)
-        usage
-        exit 1
-        ;;
-    *)
-        command[${#command[@]}]="$1"
-        shift
-        ;;
-    esac
-done
-
-if [ -n "$script" ] ; then
-    if [ ${#command[@]} -gt 0 ] ; then
-        printf "%s error: cannot give -f script and command arguments at the same time.\n" "$pname"
-        usage
-        exit 1
-    fi
-    if [ ! -r "$script" ] ; then
-        printf "%s error: cannot read %s.\n" "$pname" "$script"
-        usage
-        exit 1
-    fi
-fi
-
-
-# AHOSTS=
-# for h in $HOSTS ; do
-#     ping -q -c 1 -w 4 $h >/dev/null 2>&1 \
-#         && AHOSTS="$AHOSTS $h"
-# done
-
-AHOSTS=(${HOSTS[@]})
-
-quote(){
+function quote(){
     for arg ; do
         local slash=${arg//\\/\\\\}
         local quote=\'${slash//\'/\'\\\'\'}\' # no "${...}" here! It would break the \'
@@ -113,30 +59,109 @@ quote(){
     printf "\n"
 }

-args=$(quote "${command[@]}")

+function all_hosts(){
+    local args="$(quote "${@}")"
+
+    # AHOSTS=
+    # for h in $HOSTS ; do
+    #     ping -q -c 1 -w 4 $h >/dev/null 2>&1 \
+        #         && AHOSTS="$AHOSTS $h"
+    # done
+
+    local ahosts=(${HOSTS[@]})
+
+
+    # printf "script='%s'\n" "$script"
+    # printf "remtemp='%s'\n" "$remtemp"
+    # printf "command='%s'\n" "${command[@]}"
+    # printf "args=%s\n" "$args"
+    # exit 0
+
+    for h in ${ahosts[@]} ; do
+        hostheader "$h"
+        if [ -n "$script" ] ; then
+            remtemp="${pname}-${script}-$(hostname)-${h}-$$.sh"
+            if [ $verbose -gt 0 ] ; then
+                verbose=2
+            fi
+            docmd scp "$script" "${h}:~/${remtemp}"
+            docmd ssh -x "${h}" bash -c "\"( chmod 755 ~/${remtemp} ; ~/${remtemp} > ~/${remtemp}.out 2> ~/${remtemp}.err ; rm ~/${remtemp} )\""
+            docmd scp "${h}:~/${remtemp}.out" "${h}:~/${remtemp}.err" /tmp/
+            docmd ssh -x "${h}" bash -c "\"( rm ~/${remtemp}.out ~/${remtemp}.err )\""
+            docmd cat /tmp/${remtemp}.out /tmp/${remtemp}.err
+        else
+            docmd ssh -x $h bash -c "$(quote "$args")"
+        fi
+    done
+}

-# printf "script='%s'\n" "$script"
-# printf "remtemp='%s'\n" "$remtemp"
-# printf "command='%s'\n" "${command[@]}"
-# printf "args=%s\n" "$args"
-# exit 0
+function main(){
+    expect=none
+    script=""
+    command=()
+    while [ $# -gt 0 ] ; do
+        case $expect in
+        (none)
+            case "$1" in
+            (-s|--short)
+                verbose=0
+                shift
+                ;;
+            (-h|--host)
+                verbose=1
+                shift
+                ;;
+            (-v|--verbose)
+                verbose=2
+                shift
+                ;;
+            (-f|--script)
+                shift
+                script="$1"
+                shift
+                ;;
+            (--)
+                expect=command
+                shift
+                ;;
+            (-*)
+                usage
+                exit 1
+                ;;
+            (*)
+                expect=command
+                command[${#command[@]}]="$1"
+                shift
+                ;;
+            esac
+            ;;
+        (command)
+            command[${#command[@]}]="$1"
+            shift
+            ;;
+        esac
+    done

-for h in ${AHOSTS[@]} ; do
-    hostheader "$h"
     if [ -n "$script" ] ; then
-        remtemp="${pname}-${script}-$(hostname)-${h}-$$.sh"
-        if [ $verbose -gt 0 ] ; then
-            verbose=2
+        if [ ${#command[@]} -gt 0 ] ; then
+            printf "%s error: cannot give -f script and command arguments at the same time.\n" "$pname"
+            usage
+            exit 1
+        fi
+        if [ ! -r "$script" ] ; then
+            printf "%s error: cannot read %s.\n" "$pname" "$script"
+            usage
+            exit 1
         fi
-        docmd scp "$script" "${h}:~/${remtemp}"
-        docmd ssh -x "${h}" bash -c "\"( chmod 755 ~/${remtemp} ; ~/${remtemp} > ~/${remtemp}.out 2> ~/${remtemp}.err ; rm ~/${remtemp} )\""
-        docmd scp "${h}:~/${remtemp}.out" "${h}:~/${remtemp}.err" /tmp/
-        docmd ssh -x "${h}" bash -c "\"( rm ~/${remtemp}.out ~/${remtemp}.err )\""
-        docmd cat /tmp/${remtemp}.out /tmp/${remtemp}.err
-    else
-        docmd ssh -x $h bash -c "$(quote "$args")"
     fi
-done
+
+    all_hosts "${command[@]}"
+}
+
+main "$@"
+
+
+

 #### END ####
diff --git a/cycle-patchwork-errors b/cycle-patchwork-errors
new file mode 100755
index 0000000..362d104
--- /dev/null
+++ b/cycle-patchwork-errors
@@ -0,0 +1,4 @@
+#!/bin/bash
+rm -f ~/Desktop/Patchwork-errors.txt
+touch ~/Desktop/Patchwork-errors.txt
+
diff --git a/gcc-include-directories b/gcc-include-directories
new file mode 100755
index 0000000..c582aab
--- /dev/null
+++ b/gcc-include-directories
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo | gcc -Wp,-v -x c++ - -fsyntax-only
diff --git a/gcc-warnings.lisp b/gcc-warnings.lisp
new file mode 100644
index 0000000..bd75e0c
--- /dev/null
+++ b/gcc-warnings.lisp
@@ -0,0 +1,250 @@
+(SETF (READTABLE-CASE *READTABLE*) :PRESERVE)
+
+(DEFPARAMETER -Wall
+  '(
+    -Waddress
+    -Warray-bounds=1                       ; (only with -O2)
+    -Warray-parameter=2                    ; (C and Objective-C only)
+    -Wbool-compare
+    -Wbool-operation
+    -Wc++11-compat  -Wc++14-compat
+    -Wcatch-value                        ; (C++ and Objective-C++ only)
+    -Wchar-subscripts
+    -Wcomment
+    -Wduplicate-decl-specifier             ; (C and Objective-C only)
+    -Wenum-compare           ; (in C/ObjC; this is on by default in C++)
+    -Wformat
+    -Wformat-overflow
+    -Wformat-truncation
+    -Wint-in-bool-context
+    -Wimplicit                             ; (C and Objective-C only)
+    -Wimplicit-int                         ; (C and Objective-C only)
+    -Wimplicit-function-declaration        ; (C and Objective-C only)
+    -Winit-self                            ; (only for C++)
+    -Wlogical-not-parentheses
+    -Wmain                ; (only for C/ObjC and unless -ffreestanding)
+    -Wmaybe-uninitialized
+    -Wmemset-elt-size
+    -Wmemset-transposed-args
+    -Wmisleading-indentation               ; (only for C/C++)
+    -Wmissing-attributes
+    -Wmissing-braces                       ; (only for C/ObjC)
+    -Wmultistatement-macros
+    -Wnarrowing                            ; (only for C++)
+    -Wnonnull
+    -Wnonnull-compare
+    -Wopenmp-simd
+    -Wparentheses
+    -Wpessimizing-move                     ; (only for C++)
+    -Wpointer-sign
+    -Wrange-loop-construct                 ; (only for C++)
+    -Wreorder
+    -Wrestrict
+    -Wreturn-type
+    -Wsequence-point
+    -Wsign-compare                         ; (only in C++)
+    -Wsizeof-array-div
+    -Wsizeof-pointer-div
+    -Wsizeof-pointer-memaccess
+    -Wstrict-aliasing
+    -Wstrict-overflow=1
+    -Wswitch
+    -Wtautological-compare
+    -Wtrigraphs
+    -Wuninitialized
+    -Wunknown-pragmas
+    -Wunused-function
+    -Wunused-label
+    -Wunused-value
+    -Wunused-variable
+    -Wvla-parameter                        ; (C and Objective-C only)
+    -Wvolatile-register-var
+    -Wzero-length-bounds
+    ))
+
+
+(DEFPARAMETER -Wextra
+  '(
+    -Wclobbered
+    -Wcast-function-type
+    -Wdeprecated-copy                   ; (C++ only)
+    -Wempty-body
+    -Wenum-conversion                   ; (C only)
+    -Wignored-qualifiers
+    -Wimplicit-fallthrough=3
+    -Wmissing-field-initializers
+    -Wmissing-parameter-type            ; (C only)
+    -Wold-style-declaration             ; (C only)
+    -Woverride-init
+    -Wsign-compare                      ; (C only)
+    -Wstring-compare
+    -Wredundant-move                    ; (only for C++)
+    -Wtype-limits
+    -Wuninitialized
+    -Wshift-negative-value         ; (in C++03 and in C99 and newer)
+    -Wunused-parameter             ; (only with -Wunused or -Wall)
+    -Wunused-but-set-parameter     ; (only with -Wunused or -Wall)
+    ))
+
+
+
+(DEFPARAMETER *all-options*
+  '(-Wabi -Wchar-subscripts -Wno-coverage-mismatch -Wno-cpp
+    -Wdouble-promotion -Wduplicate-decl-specifier -Wformat -Wformat=n
+    -Wformat=1 -Wformat -Wformat=2 -Wno-format-contains-nul
+    -Wno-format-extra-args -Wformat-overflow -Wformat-overflow=level
+    -Wformat-overflow -Wformat-overflow=1 -Wformat-overflow=2
+    -Wno-format-zero-length -Wformat-nonliteral -Wformat-security
+    -Wformat-signedness -Wformat-truncation -Wformat-truncation=level
+    -Wformat-truncation -Wformat-truncation=1 -Wformat-truncation=2
+    -Wformat-y2k -Wnonnull -Wnonnull -Wnonnull-compare -Wnonnull-compare
+    -Wnull-dereference -Winit-self -Wno-implicit-int
+    -Wno-implicit-function-declaration -Wimplicit -Wimplicit-fallthrough
+    -Wimplicit-fallthrough -Wimplicit-fallthrough=n
+    -Wimplicit-fallthrough=0 -Wimplicit-fallthrough=1
+    -Wimplicit-fallthrough=2 -Wimplicit-fallthrough=3 -fallthrough
+    -Wimplicit-fallthrough=4 -fallthrough -Wimplicit-fallthrough=5
+    -Wno-if-not-aligned -Wignored-qualifiers -Wno-ignored-attributes
+    -Wmain -Wmisleading-indentation -Wmissing-attributes
+    -Wmissing-attributes -Wmissing-braces -Wmissing-include-dirs
+    -Wno-missing-profile -Wno-mismatched-dealloc -Wmultistatement-macros
+    -Wparentheses -Wsequence-point -Wno-return-local-addr -Wreturn-type
+    -Wno-shift-count-negative -Wno-shift-count-overflow
+    -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
+    -Wshift-overflow=1 -Wshift-overflow=2 -Wswitch -Wswitch-default
+    -Wswitch-enum -Wno-switch-bool -Wno-switch-outside-range
+    -Wno-switch-unreachable -Wswitch-unreachable -Wsync-nand
+    -Wunused-but-set-parameter -Wunused-but-set-variable
+    -Wunused-function -Wunused-label -Wunused-local-typedefs
+    -Wunused-parameter -Wno-unused-result -Wunused-variable
+    -Wunused-const-variable -Wunused-const-variable=n
+    -Wunused-const-variable=1 -Wunused-const-variable=2 -Wunused-value
+    -Wunused -Wuninitialized -Wno-invalid-memory-model
+    -Winvalid-memory-model -Wmaybe-uninitialized -Wunknown-pragmas
+    -Wno-pragmas -Wno-prio-ctor-dtor -Wstrict-aliasing
+    -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
+    -Wstrict-overflow=1 -Wstrict-overflow=2 -Wstrict-overflow=3
+    -Wstrict-overflow=4 -Wstrict-overflow=5 -Wstring-compare
+    -Wstring-compare -Wno-stringop-overflow -Wstringop-overflow
+    -Wstringop-overflow=type -Wstringop-overflow -Wstringop-overflow=1
+    -Wstringop-overflow=2 -Wstringop-overflow=3 -Wstringop-overflow=4
+    -Wno-stringop-overread -Wno-stringop-truncation -Wsuggest-attribute
+    -Wsuggest-attribute=pure -Wsuggest-attribute=const
+    -Wsuggest-attribute=noreturn -Wmissing-noreturn
+    -Wsuggest-attribute=malloc -Wsuggest-attribute=format
+    -Wmissing-format-attribute -Wsuggest-attribute=cold -Walloc-zero
+    -Walloc-size-larger-than=byte-size -Wno-alloc-size-larger-than
+    -Walloca -Walloca-larger-than=byte-size
+    -Walloca-larger-than=‘PTRDIFF_MAX’ -Wno-alloca-larger-than
+    -Warith-conversion -Warray-bounds -Warray-bounds=n -Warray-bounds=1
+    -Warray-bounds=2 -Warray-parameter -Warray-parameter=n
+    -Warray-parameter=2 -Wattribute-alias=n -Wno-attribute-alias
+    -Wattribute-alias=1 -Wattribute-alias=2 -Wattribute-alias
+    -Wbool-compare -Wbool-operation -Wduplicated-branches
+    -Wduplicated-cond -Wframe-address -Wno-discarded-qualifiers
+    -Wno-discarded-array-qualifiers -Wno-incompatible-pointer-types
+    -Wno-int-conversion -Wzero-length-bounds -Wno-div-by-zero
+    -Wsystem-headers -Wtautological-compare -Wtrampolines -Wfloat-equal
+    -Wtraditional -Wtraditional-conversion -Wdeclaration-after-statement
+    -Wshadow -Wno-shadow-ivar -Wshadow=global -Wshadow=local
+    -Wshadow=compatible-local -Wlarger-than=byte-size -Wno-larger-than
+    -Wframe-larger-than=byte-size -Wno-frame-larger-than
+    -Wno-free-nonheap-object -Wfree-nonheap-object
+    -Wstack-usage=byte-size -Wstack-usage=‘PTRDIFF_MAX’ -Wno-stack-usage
+    -Wunsafe-loop-optimizations -Wno-pedantic-ms-format -Wpointer-arith
+    -Wno-pointer-compare -Wtsan -Wtype-limits -Wabsolute-value -Wcomment
+    -Wcomments -Wtrigraphs -Wundef -Wexpansion-to-defined
+    -Wunused-macros -Wno-endif-labels -Wbad-function-cast
+    -Wc90-c99-compat -Wc99-c11-compat -Wc11-c2x-compat -Wc++-compat
+    -Wc++11-compat -Wc++14-compat -Wc++17-compat -Wc++20-compat
+    -Wno-c++11-extensions -Wno-c++14-extensions -Wno-c++17-extensions
+    -Wno-c++20-extensions -Wno-c++23-extensions -Wcast-qual -Wcast-align
+    -Wcast-align=strict -Wcast-function-type -Wwrite-strings -Wclobbered
+    -Wconversion -Wdangling-else -Wdate-time -Wempty-body
+    -Wno-endif-labels -Wenum-compare -Wenum-conversion
+    -Wjump-misses-init -Wjump-misses-init -Wsign-compare
+    -Wsign-conversion -Wfloat-conversion -Wno-scalar-storage-order
+    -Wsizeof-array-div -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
+    -Wno-sizeof-array-argument -Wmemset-elt-size
+    -Wmemset-transposed-args -Waddress -Wno-address-of-packed-member
+    -Wlogical-op -Wlogical-not-parentheses -Waggregate-return
+    -Wno-aggressive-loop-optimizations -Wno-attributes
+    -Wno-builtin-declaration-mismatch -Wno-builtin-macro-redefined
+    -Wstrict-prototypes -Wold-style-declaration -Wold-style-definition
+    -Wmissing-parameter-type -Wmissing-prototypes -Wmissing-declarations
+    -Wmissing-field-initializers -Wno-multichar -Wnormalized
+    -Wno-attribute-warning -Wno-deprecated -Wno-deprecated-declarations
+    -Wno-overflow -Wno-odr -Wopenacc-parallelism -Wopenmp-simd
+    -Woverride-init -Wno-override-init-side-effects -Wpacked
+    -Wnopacked-bitfield-compat -Wpacked-not-aligned -Wpadded
+    -Wredundant-decls -Wrestrict -Wnested-externs -Winline
+    -Wint-in-bool-context -Wno-int-to-pointer-cast
+    -Wno-pointer-to-int-cast -Winvalid-pch -Wlong-long -Wvariadic-macros
+    -Wno-varargs -Wvector-operation-performance -Wvla
+    -Wvla-larger-than=byte-size -Wvla-larger-than=‘PTRDIFF_MAX’
+    -Wno-vla-larger-than -Wvla-parameter -Wvla-parameter
+    -Wvolatile-register-var -Wdisabled-optimization -Wpointer-sign
+    -Wstack-protector -Woverlength-strings -Wunsuffixed-float-constants
+    -Wno-lto-type-mismatch -Wno-designated-init ))
+
+(VALUES (LENGTH *all-options*)
+        (LENGTH (SET-DIFFERENCE *all-options* -Wall))
+        (LENGTH (SET-DIFFERENCE *all-options* -Wextra))
+        (LENGTH (SET-DIFFERENCE (SET-DIFFERENCE *all-options* -Wextra) -Wall))
+        (SET-DIFFERENCE (SET-DIFFERENCE *all-options* -Wextra) -Wall))
+292
+233
+274
+217
+
+(defparameter *added
+  '(-Wformat-nonliteral
+    -Wformat-security
+    -Wformat-signedness
+    -Wformat-truncation
+    -Wnull-dereference
+    -Wmissing-include-dirs
+    -Wshift-overflow=2
+    -Wswitch-default
+    -Wswitch-enum
+    -Wswitch-unreachable
+    -Wunused-but-set-variable
+    -Wunused-local-typedefs
+    -Wunused-const-variable
+    -Wunused
+    -Wstringop-overflow=4
+    -Walloc-zero
+    -Walloca
+    -Warith-conversion
+    -Warray-bounds=2
+    -Warray-parameter=2
+    -Wduplicated-branches
+    -Wduplicated-cond
+    -Wframe-address
+    -Wtrampolines
+    -Wshadow
+    -Wfree-nonheap-object
+    -Wunsafe-loop-optimizations
+    -Wconversion
+    -Wpointer-arith
+    -Wundef
+    -Wexpansion-to-defined
+    -Wunused-macros
+    -Wbad-function-cast
+    -Wdangling-else
+    -Wdate-time
+    -Wjump-misses-init
+    -Wlogical-op
+    -Waggregate-return
+    -Wstrict-prototypes
+    -Wmissing-prototypes
+    -Wmissing-declarations
+    -Wredundant-decls
+    -Wnested-externs
+    -Winline
+    -fstack-protector
+    -Wstack-protector
+    -Woverlength-strings
+    ))
+
+
diff --git a/git-find-file b/git-find-file
new file mode 100755
index 0000000..966374e
--- /dev/null
+++ b/git-find-file
@@ -0,0 +1,6 @@
+#!/bin/bash
+# https://github.com/albfan/git-find-file
+for branch in $(git for-each-ref --format="%(refname)" refs/heads) ; do
+    echo "${branch}"
+    git ls-tree -r --name-only "${branch}" | grep -e "$1"
+done
diff --git a/idle b/idle
new file mode 100755
index 0000000..f82ac21
--- /dev/null
+++ b/idle
@@ -0,0 +1,13 @@
+#!/bin/bash
+delay=20
+touch ~/.idle.pid
+kill $(cat ~/.idle.pid) > /dev/null 2>&1 || true
+(
+    sleep $delay
+    printf ' -l ' > ~/.idle.pid
+    #
+    printf '\n'
+    banner "$(hostname)"
+    printf '\n'
+    #
+) & echo $! > ~/.idle.pid
diff --git a/macosx-ldd b/macosx-ldd
new file mode 100755
index 0000000..ab71d82
--- /dev/null
+++ b/macosx-ldd
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec otool -L "$@"
diff --git a/sq11-timerset b/sq11-timerset
new file mode 100755
index 0000000..20bad2f
Binary files /dev/null and b/sq11-timerset differ
diff --git a/tb b/tb
new file mode 100755
index 0000000..a0b60c7
--- /dev/null
+++ b/tb
@@ -0,0 +1,9 @@
+#!/bin/bash
+nc termbin.com 9999 | tr -d '\000'
+
+    # | xclip -i
+# xclip -o
+
+
+
+
diff --git a/wget-nc b/wget-nc
new file mode 100755
index 0000000..66d1f6b
--- /dev/null
+++ b/wget-nc
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec wget --no-check-certificate "$@"
ViewGit