initial commit

This commit is contained in:
2026-04-06 19:41:06 -06:00
parent ad0fc7039a
commit 178acd261a
14 changed files with 683 additions and 0 deletions

53
bash/.functions~ Normal file
View File

@@ -0,0 +1,53 @@
# Bash Functions
mkcd()
{
mkdir -p -- "$1" && cd -P -- "$1"
}
# determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* ./*;
fi;
}
# use Gits colored diff when available
hash git &>/dev/null;
if [ $? -eq 0 ]; then
function diff() {
git diff --no-index --color-words "$@";
}
fi;
## system administration
### service files
sysedit() {
local svc="$1"
sudo systemctl edit --full "$svc"
read -p "Reload + restart $svc? [y/N]: " ans
if [[ "$ans" == "y" ]]; then
sudo systemctl daemon-reload
sudo systemctl restart "$svc"
fi
}
sysadd() {
local svc="$1"
sudo systemctl edit "$svc"
read -p "Reload + restart $svc? [y/N]: " ans
if [[ "$ans" == "y" ]]; then
sudo systemctl daemon-reload
sudo systemctl restart "$svc"
fi
}