diff --git a/.gitattributes b/.gitattributes index 09bae7f..f3e1f99 100644 --- a/.gitattributes +++ b/.gitattributes @@ -220,8 +220,3 @@ git/* text **/alias text ssh/* text -# Git Crypt special files -*-secret filter=git-crypt diff=git-crypt -*.key filter=git-crypt diff=git-crypt -secrets/** filter=git-crypt diff=git-crypt - diff --git a/config/exports b/config/exports index 7049f47..92c10f6 100755 --- a/config/exports +++ b/config/exports @@ -18,8 +18,8 @@ export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_ # Load bash completions if available for zsh if [[ -n "$ZSH_VERSION" ]]; then - autoload bashcompinit - bashcompinit + autoload bashcompinit + bashcompinit fi # Load asdf diff --git a/config/homebrew/Brewfile b/config/homebrew/Brewfile index bfd9ee5..183c02b 100644 --- a/config/homebrew/Brewfile +++ b/config/homebrew/Brewfile @@ -77,10 +77,6 @@ brew "cryptography" brew "curl" # Lightweight DNS forwarder and DHCP server brew "dnsmasq" -# Spellchecker wrapping library -brew "enchant" -# Banner-like program prints strings as ASCII art -brew "figlet" # Lock file during command brew "flock" # Libraries to talk to Microsoft SQL Server and Sybase databases @@ -91,28 +87,14 @@ brew "gd" brew "gh" # Distributed revision control system brew "git" -# Enable transparent encryption/decryption of files in a git repo -brew "git-crypt" -# Small git utilities -brew "git-extras" -# See your latest local git branches, formatted real fancy -brew "git-recent" # Render markdown on the CLI brew "glow" -# GNU implementation of the famous stream editor -brew "gnu-sed" # Validating, recursive, caching DNS resolver brew "unbound" # GNU Transport Layer Security (TLS) Library brew "gnutls" # GNU Pretty Good Privacy (PGP) package brew "gnupg" -# Library access to GnuPG -brew "gpgme" -# Open source suite of directory software -brew "openldap" -# Manage your GnuPG keys with ease! -brew "gpg-tui" # Image manipulation brew "netpbm" # C/C++ and Java libraries for Unicode and globalization @@ -125,8 +107,6 @@ brew "pango" brew "librsvg" # Graph visualization software from AT&T and Bell Labs brew "graphviz" -# GNU grep, egrep and fgrep -brew "grep" # Popular GNU data compression program brew "gzip" # Improved top (interactive process viewer) @@ -157,18 +137,14 @@ brew "libuv" brew "libyaml" # Package manager for the Lua programming language brew "luarocks" -# LZMA-based compression program similar to gzip or bzip2 -brew "lzip" # Swiss Army Knife for macOS brew "m-cli" -# NCurses Disk Usage -brew "ncdu" # HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server brew "nginx" # Port scanning utility for large networks brew "nmap" -# Cryptography and SSL/TLS Toolkit -brew "openssl@1.1" +# Open source suite of directory software +brew "openldap" # General-purpose scripting language brew "php" # Manage compile and link flags for libraries @@ -193,10 +169,8 @@ brew "wget" brew "xdg-ninja", args: ["HEAD"] # Watcher for macOS 10.14+ light/dark mode changes brew "cormacrelf/tap/dark-notify" -# lets you quickly switch between multiple git user profiles -brew "gesquive/tap/git-user" -# Automated code review tool integrated with any code analysis tools regardless of programming language. -brew "reviewdog/tap/reviewdog" +# Igbinary PHP extension +brew "shivammathur/extensions/igbinary@8.3" # Imagick PHP extension brew "shivammathur/extensions/imagick@8.3" # Mcrypt PHP extension diff --git a/local/bin/dfm b/local/bin/dfm index 5d54d5e..fb6a4a1 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -44,6 +44,23 @@ if ! declare -f msg_done > /dev/null; then } fi +if ! declare -f array_diff > /dev/null; then + # Function to compare two arrays and return the difference + # Example: array_diff DIFFERENCE ARRAY1 ARRAY2 + # $1 - variable to store the difference + # $2 - first array + # $3 - second array + # Output to $1 the difference between $2 and $3 + # Source: https://stackoverflow.com/a/42399479/594940 + array_diff() + { + eval local ARR1=\(\"\${$2[@]}\"\) + eval local ARR2=\(\"\${$3[@]}\"\) + local IFS=$'\n' + mapfile -t "$1" < <(comm -23 <(echo "${ARR1[*]}" | sort) <(echo "${ARR2[*]}" | sort)) + } +fi + VERSION_NVM="v0.39.5" # Loads configs for better installation experience @@ -293,6 +310,7 @@ section_brew() "autoupdate:Setups brew auto-update and runs it immediately" "leaves:List brew leaves (installed on request)" "clean:Clean up brew packages" + "untracked:List untracked brew packages" ) x-have brew && { @@ -318,6 +336,46 @@ section_brew() leaves) brew leaves --installed-on-request ;; + untracked) + declare -a BREW_LIST_ALL + while IFS= read -r line; do + BREW_LIST_ALL+=("$line") + done < <(brew list --formula --installed-on-request -1 --full-name) + while IFS= read -r c; do + BREW_LIST_ALL+=("$c") + done < <(brew list --cask -1 --full-name) + + # Remove entries that are installed as dependencies + declare -a BREW_LIST_DEPENDENCIES + while IFS= read -r l; do + BREW_LIST_DEPENDENCIES+=("$l") + done < <(brew list -1 --installed-as-dependency) + + declare -a BREW_LIST_BUNDLED + while IFS= read -r b; do + BREW_LIST_BUNDLED+=("$b") + done < <(brew bundle list --all --file="$BREWFILE") + + declare -a BREW_LIST_TRACKED_WITHOUT_DEPS + for f in "${BREW_LIST_ALL[@]}"; do + if [[ ! " ${BREW_LIST_DEPENDENCIES[@]} " =~ " ${f} " ]]; then + BREW_LIST_TRACKED_WITHOUT_DEPS+=("$f") + fi + done + + array_diff BREW_LIST_UNTRACKED BREW_LIST_TRACKED_WITHOUT_DEPS BREW_LIST_BUNDLED + + # If there are no untracked packages, exit + if [ ${#BREW_LIST_UNTRACKED[@]} -eq 0 ]; then + msg_yay "No untracked packages found!" + exit 0 + fi + + echo "Untracked:" + for f in "${BREW_LIST_UNTRACKED[@]}"; do + echo " $f" + done + ;; clean) brew bundle cleanup --file="$BREWFILE" && msg_yay "Done!" ;; @@ -421,7 +479,9 @@ section_dotfiles() ! x-have shfmt && msg_err "shfmt not found, install with asdf" # Format shell scripts according to following rules. fd --full-path "$DOTFILES" -tx \ + --hidden \ -E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \ + -E 'test' -E '**/bin/asdf/**' -E '**/tldr/*' \ -x shfmt \ --language-dialect bash \ --func-next-line --list --write \ diff --git a/local/bin/x-term-colors b/local/bin/x-term-colors index d70a6f9..9820e3e 100755 --- a/local/bin/x-term-colors +++ b/local/bin/x-term-colors @@ -9,12 +9,12 @@ setBackgroundColor() { - echo -en "\x1b[48;2;$1;$2;$3""m" + echo -en "\x1b[48;2;$1;$2;$3""m" } resetOutput() { - echo -en "\x1b[0m\n" + echo -en "\x1b[0m\n" } # Gives a color $1/255 % along HSV @@ -24,76 +24,69 @@ resetOutput() # ranging between 0 and 255 inclusive rainbowColor() { - let h=$1/43 - let f=$1-43*$h - let t=$f*255/43 - let q=255-t + let h=$1/43 + let f=$1-43*$h + let t=$f*255/43 + let q=255-t - if [ $h -eq 0 ] - then - echo "255 $t 0" - elif [ $h -eq 1 ] - then - echo "$q 255 0" - elif [ $h -eq 2 ] - then - echo "0 255 $t" - elif [ $h -eq 3 ] - then - echo "0 $q 255" - elif [ $h -eq 4 ] - then - echo "$t 0 255" - elif [ $h -eq 5 ] - then - echo "255 0 $q" - else - # execution should never reach here - echo "0 0 0" - fi + if [ $h -eq 0 ]; then + echo "255 $t 0" + elif [ $h -eq 1 ]; then + echo "$q 255 0" + elif [ $h -eq 2 ]; then + echo "0 255 $t" + elif [ $h -eq 3 ]; then + echo "0 $q 255" + elif [ $h -eq 4 ]; then + echo "$t 0 255" + elif [ $h -eq 5 ]; then + echo "255 0 $q" + else + # execution should never reach here + echo "0 0 0" + fi } for i in $(seq 0 127); do - setBackgroundColor "$i" 0 0 - echo -en " " + setBackgroundColor "$i" 0 0 + echo -en " " done resetOutput for i in $(seq 255 128); do - setBackgroundColor "$i" 0 0 - echo -en " " + setBackgroundColor "$i" 0 0 + echo -en " " done resetOutput for i in $(seq 0 127); do - setBackgroundColor 0 "$i" 0 - echo -n " " + setBackgroundColor 0 "$i" 0 + echo -n " " done resetOutput for i in $(seq 255 128); do - setBackgroundColor 0 "$i" 0 - echo -n " " + setBackgroundColor 0 "$i" 0 + echo -n " " done resetOutput for i in $(seq 0 127); do - setBackgroundColor 0 0 "$i" - echo -n " " + setBackgroundColor 0 0 "$i" + echo -n " " done resetOutput for i in $(seq 255 128); do - setBackgroundColor 0 0 "$i" - echo -n " " + setBackgroundColor 0 0 "$i" + echo -n " " done resetOutput for i in $(seq 0 127); do - setBackgroundColor $(rainbowColor "$i") - echo -n " " + setBackgroundColor $(rainbowColor "$i") + echo -n " " done resetOutput for i in $(seq 255 128); do - setBackgroundColor $(rainbowColor "$i") - echo -n " " + setBackgroundColor $(rainbowColor "$i") + echo -n " " done resetOutput - diff --git a/secrets/.gitkeep b/secrets/.gitkeep index 36853e9..e69de29 100644 Binary files a/secrets/.gitkeep and b/secrets/.gitkeep differ