Added some scripts

This commit is contained in:
2021-12-28 15:20:30 -05:00
parent 226e07f501
commit f9892ee952
5 changed files with 48 additions and 0 deletions

16
scripts/.local/scripts/figl Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Create a new figlet (ascii art) from the input.
figl() {
font=${FIGL_FONT:-puffy}
declare -a buf
while IFS= read -r line; do
buf+=("$line")
done
for line in "${buf[@]}"; do
figlet -f "$font" -c "${line}" | head -6
done
}
figl "$*"

24
scripts/.local/scripts/newx Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
# Creates a new executable file in the $SCRIPTS directory.
# check if the scripts path / environment variable is set
test ! -n "${SCRIPTS}" && echo "SCRIPTS not set" && exit 1;
# fallback to check if the name arg ${1} exists, if not show usage text.
test ! -n "${1}" && echo "usage: newscript <name>" && exit 1;
path="${SCRIPTS}/${1}"
if [ -e "${path}" ]; then
read -p "${1} already exists. Edit? " yes
case "${yes}" in
y|yes|yep|yeppers|yeah|ok|okay) exec vim "${path}"
esac
exit 0
fi
printf "#!/bin/sh\n\n" > "${path}"
chmod +x "${path}"
exec vim +2 "${path}"

2
scripts/.local/scripts/path Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/zsh
echo -e ${PATH//:/\\n}

View File

@@ -63,6 +63,8 @@ fpath_prepend() {
# last arg will be first in path
path_prepend \
"/opt/homebrew/bin" \
"/opt/homebrew/sbin" \
"$(brew --prefix)/sbin" \
"$(brew --prefix)/bin" \
"$HOME/.local/bin" \

View File

@@ -39,6 +39,7 @@ alias l() { ls -lah "$@" }
# editor
alias vim() { nvim "$@" }
alias vi() { nvim "$@" }
# git
alias g() { git "$@" }
@@ -58,6 +59,9 @@ if [ $(hostname -s) = "Michaels-Mac-mini" ]; then
alias projects() { cd "/Volumes/M1 Mac-Mini External Drive/Projects" }
fi
# change file to be executable
alias chmox() { chmod +x "$@" }
# tmux
#alias ta() { tmux -f ~/.config/tmux/tmux.config attach "$@" }