mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 03:04:06 +00:00
chore: more cleanup, linting and fixes
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -220,8 +220,3 @@ git/* text
|
|||||||
**/alias text
|
**/alias text
|
||||||
ssh/* 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
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
# Load bash completions if available for zsh
|
||||||
if [[ -n "$ZSH_VERSION" ]]; then
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
autoload bashcompinit
|
autoload bashcompinit
|
||||||
bashcompinit
|
bashcompinit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load asdf
|
# Load asdf
|
||||||
|
|||||||
@@ -77,10 +77,6 @@ brew "cryptography"
|
|||||||
brew "curl"
|
brew "curl"
|
||||||
# Lightweight DNS forwarder and DHCP server
|
# Lightweight DNS forwarder and DHCP server
|
||||||
brew "dnsmasq"
|
brew "dnsmasq"
|
||||||
# Spellchecker wrapping library
|
|
||||||
brew "enchant"
|
|
||||||
# Banner-like program prints strings as ASCII art
|
|
||||||
brew "figlet"
|
|
||||||
# Lock file during command
|
# Lock file during command
|
||||||
brew "flock"
|
brew "flock"
|
||||||
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
# Libraries to talk to Microsoft SQL Server and Sybase databases
|
||||||
@@ -91,28 +87,14 @@ brew "gd"
|
|||||||
brew "gh"
|
brew "gh"
|
||||||
# Distributed revision control system
|
# Distributed revision control system
|
||||||
brew "git"
|
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
|
# Render markdown on the CLI
|
||||||
brew "glow"
|
brew "glow"
|
||||||
# GNU implementation of the famous stream editor
|
|
||||||
brew "gnu-sed"
|
|
||||||
# Validating, recursive, caching DNS resolver
|
# Validating, recursive, caching DNS resolver
|
||||||
brew "unbound"
|
brew "unbound"
|
||||||
# GNU Transport Layer Security (TLS) Library
|
# GNU Transport Layer Security (TLS) Library
|
||||||
brew "gnutls"
|
brew "gnutls"
|
||||||
# GNU Pretty Good Privacy (PGP) package
|
# GNU Pretty Good Privacy (PGP) package
|
||||||
brew "gnupg"
|
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
|
# Image manipulation
|
||||||
brew "netpbm"
|
brew "netpbm"
|
||||||
# C/C++ and Java libraries for Unicode and globalization
|
# C/C++ and Java libraries for Unicode and globalization
|
||||||
@@ -125,8 +107,6 @@ brew "pango"
|
|||||||
brew "librsvg"
|
brew "librsvg"
|
||||||
# Graph visualization software from AT&T and Bell Labs
|
# Graph visualization software from AT&T and Bell Labs
|
||||||
brew "graphviz"
|
brew "graphviz"
|
||||||
# GNU grep, egrep and fgrep
|
|
||||||
brew "grep"
|
|
||||||
# Popular GNU data compression program
|
# Popular GNU data compression program
|
||||||
brew "gzip"
|
brew "gzip"
|
||||||
# Improved top (interactive process viewer)
|
# Improved top (interactive process viewer)
|
||||||
@@ -157,18 +137,14 @@ brew "libuv"
|
|||||||
brew "libyaml"
|
brew "libyaml"
|
||||||
# Package manager for the Lua programming language
|
# Package manager for the Lua programming language
|
||||||
brew "luarocks"
|
brew "luarocks"
|
||||||
# LZMA-based compression program similar to gzip or bzip2
|
|
||||||
brew "lzip"
|
|
||||||
# Swiss Army Knife for macOS
|
# Swiss Army Knife for macOS
|
||||||
brew "m-cli"
|
brew "m-cli"
|
||||||
# NCurses Disk Usage
|
|
||||||
brew "ncdu"
|
|
||||||
# HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
|
# HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
|
||||||
brew "nginx"
|
brew "nginx"
|
||||||
# Port scanning utility for large networks
|
# Port scanning utility for large networks
|
||||||
brew "nmap"
|
brew "nmap"
|
||||||
# Cryptography and SSL/TLS Toolkit
|
# Open source suite of directory software
|
||||||
brew "openssl@1.1"
|
brew "openldap"
|
||||||
# General-purpose scripting language
|
# General-purpose scripting language
|
||||||
brew "php"
|
brew "php"
|
||||||
# Manage compile and link flags for libraries
|
# Manage compile and link flags for libraries
|
||||||
@@ -193,10 +169,8 @@ brew "wget"
|
|||||||
brew "xdg-ninja", args: ["HEAD"]
|
brew "xdg-ninja", args: ["HEAD"]
|
||||||
# Watcher for macOS 10.14+ light/dark mode changes
|
# Watcher for macOS 10.14+ light/dark mode changes
|
||||||
brew "cormacrelf/tap/dark-notify"
|
brew "cormacrelf/tap/dark-notify"
|
||||||
# lets you quickly switch between multiple git user profiles
|
# Igbinary PHP extension
|
||||||
brew "gesquive/tap/git-user"
|
brew "shivammathur/extensions/igbinary@8.3"
|
||||||
# Automated code review tool integrated with any code analysis tools regardless of programming language.
|
|
||||||
brew "reviewdog/tap/reviewdog"
|
|
||||||
# Imagick PHP extension
|
# Imagick PHP extension
|
||||||
brew "shivammathur/extensions/imagick@8.3"
|
brew "shivammathur/extensions/imagick@8.3"
|
||||||
# Mcrypt PHP extension
|
# Mcrypt PHP extension
|
||||||
|
|||||||
@@ -44,6 +44,23 @@ if ! declare -f msg_done > /dev/null; then
|
|||||||
}
|
}
|
||||||
fi
|
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"
|
VERSION_NVM="v0.39.5"
|
||||||
|
|
||||||
# Loads configs for better installation experience
|
# Loads configs for better installation experience
|
||||||
@@ -293,6 +310,7 @@ section_brew()
|
|||||||
"autoupdate:Setups brew auto-update and runs it immediately"
|
"autoupdate:Setups brew auto-update and runs it immediately"
|
||||||
"leaves:List brew leaves (installed on request)"
|
"leaves:List brew leaves (installed on request)"
|
||||||
"clean:Clean up brew packages"
|
"clean:Clean up brew packages"
|
||||||
|
"untracked:List untracked brew packages"
|
||||||
)
|
)
|
||||||
|
|
||||||
x-have brew && {
|
x-have brew && {
|
||||||
@@ -318,6 +336,46 @@ section_brew()
|
|||||||
leaves)
|
leaves)
|
||||||
brew leaves --installed-on-request
|
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)
|
clean)
|
||||||
brew bundle cleanup --file="$BREWFILE" && msg_yay "Done!"
|
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"
|
! x-have shfmt && msg_err "shfmt not found, install with asdf"
|
||||||
# Format shell scripts according to following rules.
|
# Format shell scripts according to following rules.
|
||||||
fd --full-path "$DOTFILES" -tx \
|
fd --full-path "$DOTFILES" -tx \
|
||||||
|
--hidden \
|
||||||
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
|
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
|
||||||
|
-E 'test' -E '**/bin/asdf/**' -E '**/tldr/*' \
|
||||||
-x shfmt \
|
-x shfmt \
|
||||||
--language-dialect bash \
|
--language-dialect bash \
|
||||||
--func-next-line --list --write \
|
--func-next-line --list --write \
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
setBackgroundColor()
|
setBackgroundColor()
|
||||||
{
|
{
|
||||||
echo -en "\x1b[48;2;$1;$2;$3""m"
|
echo -en "\x1b[48;2;$1;$2;$3""m"
|
||||||
}
|
}
|
||||||
|
|
||||||
resetOutput()
|
resetOutput()
|
||||||
{
|
{
|
||||||
echo -en "\x1b[0m\n"
|
echo -en "\x1b[0m\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gives a color $1/255 % along HSV
|
# Gives a color $1/255 % along HSV
|
||||||
@@ -24,76 +24,69 @@ resetOutput()
|
|||||||
# ranging between 0 and 255 inclusive
|
# ranging between 0 and 255 inclusive
|
||||||
rainbowColor()
|
rainbowColor()
|
||||||
{
|
{
|
||||||
let h=$1/43
|
let h=$1/43
|
||||||
let f=$1-43*$h
|
let f=$1-43*$h
|
||||||
let t=$f*255/43
|
let t=$f*255/43
|
||||||
let q=255-t
|
let q=255-t
|
||||||
|
|
||||||
if [ $h -eq 0 ]
|
if [ $h -eq 0 ]; then
|
||||||
then
|
echo "255 $t 0"
|
||||||
echo "255 $t 0"
|
elif [ $h -eq 1 ]; then
|
||||||
elif [ $h -eq 1 ]
|
echo "$q 255 0"
|
||||||
then
|
elif [ $h -eq 2 ]; then
|
||||||
echo "$q 255 0"
|
echo "0 255 $t"
|
||||||
elif [ $h -eq 2 ]
|
elif [ $h -eq 3 ]; then
|
||||||
then
|
echo "0 $q 255"
|
||||||
echo "0 255 $t"
|
elif [ $h -eq 4 ]; then
|
||||||
elif [ $h -eq 3 ]
|
echo "$t 0 255"
|
||||||
then
|
elif [ $h -eq 5 ]; then
|
||||||
echo "0 $q 255"
|
echo "255 0 $q"
|
||||||
elif [ $h -eq 4 ]
|
else
|
||||||
then
|
# execution should never reach here
|
||||||
echo "$t 0 255"
|
echo "0 0 0"
|
||||||
elif [ $h -eq 5 ]
|
fi
|
||||||
then
|
|
||||||
echo "255 0 $q"
|
|
||||||
else
|
|
||||||
# execution should never reach here
|
|
||||||
echo "0 0 0"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in $(seq 0 127); do
|
for i in $(seq 0 127); do
|
||||||
setBackgroundColor "$i" 0 0
|
setBackgroundColor "$i" 0 0
|
||||||
echo -en " "
|
echo -en " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
for i in $(seq 255 128); do
|
for i in $(seq 255 128); do
|
||||||
setBackgroundColor "$i" 0 0
|
setBackgroundColor "$i" 0 0
|
||||||
echo -en " "
|
echo -en " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
|
|
||||||
for i in $(seq 0 127); do
|
for i in $(seq 0 127); do
|
||||||
setBackgroundColor 0 "$i" 0
|
setBackgroundColor 0 "$i" 0
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
for i in $(seq 255 128); do
|
for i in $(seq 255 128); do
|
||||||
setBackgroundColor 0 "$i" 0
|
setBackgroundColor 0 "$i" 0
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
|
|
||||||
for i in $(seq 0 127); do
|
for i in $(seq 0 127); do
|
||||||
setBackgroundColor 0 0 "$i"
|
setBackgroundColor 0 0 "$i"
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
for i in $(seq 255 128); do
|
for i in $(seq 255 128); do
|
||||||
setBackgroundColor 0 0 "$i"
|
setBackgroundColor 0 0 "$i"
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
|
|
||||||
for i in $(seq 0 127); do
|
for i in $(seq 0 127); do
|
||||||
setBackgroundColor $(rainbowColor "$i")
|
setBackgroundColor $(rainbowColor "$i")
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
for i in $(seq 255 128); do
|
for i in $(seq 255 128); do
|
||||||
setBackgroundColor $(rainbowColor "$i")
|
setBackgroundColor $(rainbowColor "$i")
|
||||||
echo -n " "
|
echo -n " "
|
||||||
done
|
done
|
||||||
resetOutput
|
resetOutput
|
||||||
|
|
||||||
|
|||||||
BIN
secrets/.gitkeep
BIN
secrets/.gitkeep
Binary file not shown.
Reference in New Issue
Block a user