From: Thomas Walker Lynch Date: Fri, 6 Dec 2024 10:31:36 +0000 (+0000) Subject: updating makefile X-Git-Url: https://git.reasoningtechnology.com/fossil/honeypot?a=commitdiff_plain;h=35baa609603e5135dd75e53d781953e5d18ec3a6;p=RT-project-share updating makefile --- diff --git "a/developer/bash\360\237\226\211/bashrc" "b/developer/bash\360\237\226\211/bashrc" deleted file mode 100644 index 0914cfc..0000000 --- "a/developer/bash\360\237\226\211/bashrc" +++ /dev/null @@ -1,51 +0,0 @@ -# ssh login will fail if .bashrc writes to stdout, so we write to "bash_error.txt" -# set -x -# in F37 something seems to be caching PATH, which can be annoying - -# If not running interactively, don't do anything - case $- in - *i*) ;; - *) return;; - esac - -# This should also be the default from login.defs, because gnome ignores -# .login, .profile, etc. and uses systemd to launch applications from the desktop, - umask 0077 - -# - note the variable $PROMPT_DECOR, that is how the project name ends up in the prompt. -# - without -i bash will clear PS1, just because, so we set PPS1, ,PPS2 to not lose the profit. -# - use $(pwd) instead of \w or it will prefix '~' which confuses dirtrack when the -# user is changed using su - export PPS1='\n$($iseq/Z)[$PROMPT_DECOR]\n\u@\h§$(pwd)§\n> ' - export PPS2='>> ' - export PS1="$PPS1" - export PS2="$PPS2" - -# sort the output of printenv, show newlines as environment variable values as \n - alias printenv='printenv | awk '\''{gsub(/\n/, "\\n")}1'\'' | sort' - -# iso time in ls -l, show hidden files, human readable sizes - alias ls='ls -a -h --time-style=long-iso' - -# iso time for all Linux programs, which they will all ignore, but at least we -# tried, perhaps someday ... - export TZ=UTC - export TIME_STYLE=long-iso - export LC_ALL=en_DK.UTF-8 - -# -l don't truncate long lins -# -p show pids - alias pstree='pstree -lp' - -# - make bash gp to sleep, revealing the calling shell -# - useful for job control of multiple bash shells from a controlling shell - alias zzz="kill -STOP \$\$" - -# The one true operating system. -# Proof that an OS can be as small as an editor. - export EDITOR=emacs - -# check the window size after each command and, if necessary, update the values -# of LINES and COLUMNS. - shopt -s checkwinsize - diff --git "a/developer/bash\360\237\226\211/bashrc_example" "b/developer/bash\360\237\226\211/bashrc_example" new file mode 100644 index 0000000..0914cfc --- /dev/null +++ "b/developer/bash\360\237\226\211/bashrc_example" @@ -0,0 +1,51 @@ +# ssh login will fail if .bashrc writes to stdout, so we write to "bash_error.txt" +# set -x +# in F37 something seems to be caching PATH, which can be annoying + +# If not running interactively, don't do anything + case $- in + *i*) ;; + *) return;; + esac + +# This should also be the default from login.defs, because gnome ignores +# .login, .profile, etc. and uses systemd to launch applications from the desktop, + umask 0077 + +# - note the variable $PROMPT_DECOR, that is how the project name ends up in the prompt. +# - without -i bash will clear PS1, just because, so we set PPS1, ,PPS2 to not lose the profit. +# - use $(pwd) instead of \w or it will prefix '~' which confuses dirtrack when the +# user is changed using su + export PPS1='\n$($iseq/Z)[$PROMPT_DECOR]\n\u@\h§$(pwd)§\n> ' + export PPS2='>> ' + export PS1="$PPS1" + export PS2="$PPS2" + +# sort the output of printenv, show newlines as environment variable values as \n + alias printenv='printenv | awk '\''{gsub(/\n/, "\\n")}1'\'' | sort' + +# iso time in ls -l, show hidden files, human readable sizes + alias ls='ls -a -h --time-style=long-iso' + +# iso time for all Linux programs, which they will all ignore, but at least we +# tried, perhaps someday ... + export TZ=UTC + export TIME_STYLE=long-iso + export LC_ALL=en_DK.UTF-8 + +# -l don't truncate long lins +# -p show pids + alias pstree='pstree -lp' + +# - make bash gp to sleep, revealing the calling shell +# - useful for job control of multiple bash shells from a controlling shell + alias zzz="kill -STOP \$\$" + +# The one true operating system. +# Proof that an OS can be as small as an editor. + export EDITOR=emacs + +# check the window size after each command and, if necessary, update the values +# of LINES and COLUMNS. + shopt -s checkwinsize + diff --git "a/developer/bash\360\237\226\211/githolder" "b/developer/bash\360\237\226\211/githolder" deleted file mode 100755 index 49fb12b..0000000 --- "a/developer/bash\360\237\226\211/githolder" +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/env /bin/bash - -# Description: Descends from $1, or pwd, looking for empty directories and adds a `.githolder` to them. -# does not descend into hidden directories. - -# examples: -# > git_holder -# > git_holder --dry-run - -set -e - -find_empty_dirs() { - local dir="$1" - local dry_run="$2" - - # Skip `.git` specifically - if [[ "$(basename "$dir")" == ".git" ]]; then - return - fi - - # Check if the directory is empty (including hidden files, excluding `.` and `..`) - if [[ -z $(find "$dir" -mindepth 1 -maxdepth 1 -print -quit) ]]; then - if [[ "$dry_run" == "true" ]]; then - echo "Dry-run: Would add .githolder in $dir" - else - echo "Adding .githolder to $dir" - touch "$dir/.githolder" - fi - else - # Recurse into subdirectories - for subdir in "$dir"/*/ "$dir"/.[!.]/; do - if [[ -d "$subdir" && "$subdir" != "$dir/.[!.]/" ]]; then - find_empty_dirs "$subdir" "$dry_run" - fi - done - fi -} - -# Default parameters -dry_run="false" -target_dir="." - -# Parse arguments -while [[ $# -gt 0 ]]; do - case "$1" in - --dry-run) - dry_run="true" - shift - ;; - *) - if [[ -d "$1" ]]; then - target_dir="$1" - shift - else - echo "Invalid argument: $1 is not a directory" - exit 1 - fi - ;; - esac -done - -# Run the function -find_empty_dirs "$target_dir" "$dry_run" diff --git "a/developer/bash\360\237\226\211/githolder_to_empty_dirs" "b/developer/bash\360\237\226\211/githolder_to_empty_dirs" new file mode 100755 index 0000000..49fb12b --- /dev/null +++ "b/developer/bash\360\237\226\211/githolder_to_empty_dirs" @@ -0,0 +1,63 @@ +#!/bin/env /bin/bash + +# Description: Descends from $1, or pwd, looking for empty directories and adds a `.githolder` to them. +# does not descend into hidden directories. + +# examples: +# > git_holder +# > git_holder --dry-run + +set -e + +find_empty_dirs() { + local dir="$1" + local dry_run="$2" + + # Skip `.git` specifically + if [[ "$(basename "$dir")" == ".git" ]]; then + return + fi + + # Check if the directory is empty (including hidden files, excluding `.` and `..`) + if [[ -z $(find "$dir" -mindepth 1 -maxdepth 1 -print -quit) ]]; then + if [[ "$dry_run" == "true" ]]; then + echo "Dry-run: Would add .githolder in $dir" + else + echo "Adding .githolder to $dir" + touch "$dir/.githolder" + fi + else + # Recurse into subdirectories + for subdir in "$dir"/*/ "$dir"/.[!.]/; do + if [[ -d "$subdir" && "$subdir" != "$dir/.[!.]/" ]]; then + find_empty_dirs "$subdir" "$dry_run" + fi + done + fi +} + +# Default parameters +dry_run="false" +target_dir="." + +# Parse arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --dry-run) + dry_run="true" + shift + ;; + *) + if [[ -d "$1" ]]; then + target_dir="$1" + shift + else + echo "Invalid argument: $1 is not a directory" + exit 1 + fi + ;; + esac +done + +# Run the function +find_empty_dirs "$target_dir" "$dry_run"