Skip to content

Commit e2c37d2

Browse files
committed
chore: more cleanup, linting and fixes
1 parent 78716fa commit e2c37d2

File tree

6 files changed

+104
-82
lines changed

6 files changed

+104
-82
lines changed

.gitattributes

-5
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,3 @@ git/* text
220220
**/alias text
221221
ssh/* text
222222

223-
# Git Crypt special files
224-
*-secret filter=git-crypt diff=git-crypt
225-
*.key filter=git-crypt diff=git-crypt
226-
secrets/** filter=git-crypt diff=git-crypt
227-

config/exports

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export PATH="$XDG_BIN_HOME:$DOTFILES/local/bin:$XDG_DATA_HOME/bob/nvim-bin:$XDG_
1818

1919
# Load bash completions if available for zsh
2020
if [[ -n "$ZSH_VERSION" ]]; then
21-
autoload bashcompinit
22-
bashcompinit
21+
autoload bashcompinit
22+
bashcompinit
2323
fi
2424

2525
# Load asdf

config/homebrew/Brewfile

+4-30
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ brew "cryptography"
7777
brew "curl"
7878
# Lightweight DNS forwarder and DHCP server
7979
brew "dnsmasq"
80-
# Spellchecker wrapping library
81-
brew "enchant"
82-
# Banner-like program prints strings as ASCII art
83-
brew "figlet"
8480
# Lock file during command
8581
brew "flock"
8682
# Libraries to talk to Microsoft SQL Server and Sybase databases
@@ -91,28 +87,14 @@ brew "gd"
9187
brew "gh"
9288
# Distributed revision control system
9389
brew "git"
94-
# Enable transparent encryption/decryption of files in a git repo
95-
brew "git-crypt"
96-
# Small git utilities
97-
brew "git-extras"
98-
# See your latest local git branches, formatted real fancy
99-
brew "git-recent"
10090
# Render markdown on the CLI
10191
brew "glow"
102-
# GNU implementation of the famous stream editor
103-
brew "gnu-sed"
10492
# Validating, recursive, caching DNS resolver
10593
brew "unbound"
10694
# GNU Transport Layer Security (TLS) Library
10795
brew "gnutls"
10896
# GNU Pretty Good Privacy (PGP) package
10997
brew "gnupg"
110-
# Library access to GnuPG
111-
brew "gpgme"
112-
# Open source suite of directory software
113-
brew "openldap"
114-
# Manage your GnuPG keys with ease!
115-
brew "gpg-tui"
11698
# Image manipulation
11799
brew "netpbm"
118100
# C/C++ and Java libraries for Unicode and globalization
@@ -125,8 +107,6 @@ brew "pango"
125107
brew "librsvg"
126108
# Graph visualization software from AT&T and Bell Labs
127109
brew "graphviz"
128-
# GNU grep, egrep and fgrep
129-
brew "grep"
130110
# Popular GNU data compression program
131111
brew "gzip"
132112
# Improved top (interactive process viewer)
@@ -157,18 +137,14 @@ brew "libuv"
157137
brew "libyaml"
158138
# Package manager for the Lua programming language
159139
brew "luarocks"
160-
# LZMA-based compression program similar to gzip or bzip2
161-
brew "lzip"
162140
# Swiss Army Knife for macOS
163141
brew "m-cli"
164-
# NCurses Disk Usage
165-
brew "ncdu"
166142
# HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
167143
brew "nginx"
168144
# Port scanning utility for large networks
169145
brew "nmap"
170-
# Cryptography and SSL/TLS Toolkit
171-
146+
# Open source suite of directory software
147+
brew "openldap"
172148
# General-purpose scripting language
173149
brew "php"
174150
# Manage compile and link flags for libraries
@@ -193,10 +169,8 @@ brew "wget"
193169
brew "xdg-ninja", args: ["HEAD"]
194170
# Watcher for macOS 10.14+ light/dark mode changes
195171
brew "cormacrelf/tap/dark-notify"
196-
# lets you quickly switch between multiple git user profiles
197-
brew "gesquive/tap/git-user"
198-
# Automated code review tool integrated with any code analysis tools regardless of programming language.
199-
brew "reviewdog/tap/reviewdog"
172+
# Igbinary PHP extension
173+
brew "shivammathur/extensions/[email protected]"
200174
# Imagick PHP extension
201175
brew "shivammathur/extensions/[email protected]"
202176
# Mcrypt PHP extension

local/bin/dfm

+60
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ if ! declare -f msg_done > /dev/null; then
4444
}
4545
fi
4646

47+
if ! declare -f array_diff > /dev/null; then
48+
# Function to compare two arrays and return the difference
49+
# Example: array_diff DIFFERENCE ARRAY1 ARRAY2
50+
# $1 - variable to store the difference
51+
# $2 - first array
52+
# $3 - second array
53+
# Output to $1 the difference between $2 and $3
54+
# Source: https://stackoverflow.com/a/42399479/594940
55+
array_diff()
56+
{
57+
eval local ARR1=\(\"\${$2[@]}\"\)
58+
eval local ARR2=\(\"\${$3[@]}\"\)
59+
local IFS=$'\n'
60+
mapfile -t "$1" < <(comm -23 <(echo "${ARR1[*]}" | sort) <(echo "${ARR2[*]}" | sort))
61+
}
62+
fi
63+
4764
VERSION_NVM="v0.39.5"
4865

4966
# Loads configs for better installation experience
@@ -293,6 +310,7 @@ section_brew()
293310
"autoupdate:Setups brew auto-update and runs it immediately"
294311
"leaves:List brew leaves (installed on request)"
295312
"clean:Clean up brew packages"
313+
"untracked:List untracked brew packages"
296314
)
297315

298316
x-have brew && {
@@ -318,6 +336,46 @@ section_brew()
318336
leaves)
319337
brew leaves --installed-on-request
320338
;;
339+
untracked)
340+
declare -a BREW_LIST_ALL
341+
while IFS= read -r line; do
342+
BREW_LIST_ALL+=("$line")
343+
done < <(brew list --formula --installed-on-request -1 --full-name)
344+
while IFS= read -r c; do
345+
BREW_LIST_ALL+=("$c")
346+
done < <(brew list --cask -1 --full-name)
347+
348+
# Remove entries that are installed as dependencies
349+
declare -a BREW_LIST_DEPENDENCIES
350+
while IFS= read -r l; do
351+
BREW_LIST_DEPENDENCIES+=("$l")
352+
done < <(brew list -1 --installed-as-dependency)
353+
354+
declare -a BREW_LIST_BUNDLED
355+
while IFS= read -r b; do
356+
BREW_LIST_BUNDLED+=("$b")
357+
done < <(brew bundle list --all --file="$BREWFILE")
358+
359+
declare -a BREW_LIST_TRACKED_WITHOUT_DEPS
360+
for f in "${BREW_LIST_ALL[@]}"; do
361+
if [[ ! " ${BREW_LIST_DEPENDENCIES[@]} " =~ " ${f} " ]]; then
362+
BREW_LIST_TRACKED_WITHOUT_DEPS+=("$f")
363+
fi
364+
done
365+
366+
array_diff BREW_LIST_UNTRACKED BREW_LIST_TRACKED_WITHOUT_DEPS BREW_LIST_BUNDLED
367+
368+
# If there are no untracked packages, exit
369+
if [ ${#BREW_LIST_UNTRACKED[@]} -eq 0 ]; then
370+
msg_yay "No untracked packages found!"
371+
exit 0
372+
fi
373+
374+
echo "Untracked:"
375+
for f in "${BREW_LIST_UNTRACKED[@]}"; do
376+
echo " $f"
377+
done
378+
;;
321379
clean)
322380
brew bundle cleanup --file="$BREWFILE" && msg_yay "Done!"
323381
;;
@@ -421,7 +479,9 @@ section_dotfiles()
421479
! x-have shfmt && msg_err "shfmt not found, install with asdf"
422480
# Format shell scripts according to following rules.
423481
fd --full-path "$DOTFILES" -tx \
482+
--hidden \
424483
-E '*.pl' -E '*.php' -E '*.py' -E '*.zsh' -E 'plugins' -E 'fzf' -E 'dotbot' \
484+
-E 'test' -E '**/bin/asdf/**' -E '**/tldr/*' \
425485
-x shfmt \
426486
--language-dialect bash \
427487
--func-next-line --list --write \

local/bin/x-term-colors

+38-45
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
setBackgroundColor()
1111
{
12-
echo -en "\x1b[48;2;$1;$2;$3""m"
12+
echo -en "\x1b[48;2;$1;$2;$3""m"
1313
}
1414

1515
resetOutput()
1616
{
17-
echo -en "\x1b[0m\n"
17+
echo -en "\x1b[0m\n"
1818
}
1919

2020
# Gives a color $1/255 % along HSV
@@ -24,76 +24,69 @@ resetOutput()
2424
# ranging between 0 and 255 inclusive
2525
rainbowColor()
2626
{
27-
let h=$1/43
28-
let f=$1-43*$h
29-
let t=$f*255/43
30-
let q=255-t
27+
let h=$1/43
28+
let f=$1-43*$h
29+
let t=$f*255/43
30+
let q=255-t
3131

32-
if [ $h -eq 0 ]
33-
then
34-
echo "255 $t 0"
35-
elif [ $h -eq 1 ]
36-
then
37-
echo "$q 255 0"
38-
elif [ $h -eq 2 ]
39-
then
40-
echo "0 255 $t"
41-
elif [ $h -eq 3 ]
42-
then
43-
echo "0 $q 255"
44-
elif [ $h -eq 4 ]
45-
then
46-
echo "$t 0 255"
47-
elif [ $h -eq 5 ]
48-
then
49-
echo "255 0 $q"
50-
else
51-
# execution should never reach here
52-
echo "0 0 0"
53-
fi
32+
if [ $h -eq 0 ]; then
33+
echo "255 $t 0"
34+
elif [ $h -eq 1 ]; then
35+
echo "$q 255 0"
36+
elif [ $h -eq 2 ]; then
37+
echo "0 255 $t"
38+
elif [ $h -eq 3 ]; then
39+
echo "0 $q 255"
40+
elif [ $h -eq 4 ]; then
41+
echo "$t 0 255"
42+
elif [ $h -eq 5 ]; then
43+
echo "255 0 $q"
44+
else
45+
# execution should never reach here
46+
echo "0 0 0"
47+
fi
5448
}
5549

5650
for i in $(seq 0 127); do
57-
setBackgroundColor "$i" 0 0
58-
echo -en " "
51+
setBackgroundColor "$i" 0 0
52+
echo -en " "
5953
done
6054
resetOutput
6155
for i in $(seq 255 128); do
62-
setBackgroundColor "$i" 0 0
63-
echo -en " "
56+
setBackgroundColor "$i" 0 0
57+
echo -en " "
6458
done
6559
resetOutput
6660

6761
for i in $(seq 0 127); do
68-
setBackgroundColor 0 "$i" 0
69-
echo -n " "
62+
setBackgroundColor 0 "$i" 0
63+
echo -n " "
7064
done
7165
resetOutput
7266
for i in $(seq 255 128); do
73-
setBackgroundColor 0 "$i" 0
74-
echo -n " "
67+
setBackgroundColor 0 "$i" 0
68+
echo -n " "
7569
done
7670
resetOutput
7771

7872
for i in $(seq 0 127); do
79-
setBackgroundColor 0 0 "$i"
80-
echo -n " "
73+
setBackgroundColor 0 0 "$i"
74+
echo -n " "
8175
done
8276
resetOutput
8377
for i in $(seq 255 128); do
84-
setBackgroundColor 0 0 "$i"
85-
echo -n " "
78+
setBackgroundColor 0 0 "$i"
79+
echo -n " "
8680
done
8781
resetOutput
8882

8983
for i in $(seq 0 127); do
90-
setBackgroundColor $(rainbowColor "$i")
91-
echo -n " "
84+
setBackgroundColor $(rainbowColor "$i")
85+
echo -n " "
9286
done
9387
resetOutput
9488
for i in $(seq 255 128); do
95-
setBackgroundColor $(rainbowColor "$i")
96-
echo -n " "
89+
setBackgroundColor $(rainbowColor "$i")
90+
echo -n " "
9791
done
9892
resetOutput
99-

secrets/.gitkeep

-22 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)