Compare commits
No commits in common. "31e4b86fe3051250f4c4b27366f4a5894441b616" and "e484807e3569fd61c412f7e8ca823c294e9ebe5d" have entirely different histories.
31e4b86fe3
...
e484807e35
11 changed files with 2 additions and 204 deletions
|
@ -1,3 +0,0 @@
|
||||||
if [[ -f ~/.bashrc ]]; then
|
|
||||||
. ~/.bashrc
|
|
||||||
fi
|
|
71
.bashrc
71
.bashrc
|
@ -1,71 +0,0 @@
|
||||||
if [[ $- != *i* ]]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
###
|
|
||||||
# Default Environment
|
|
||||||
###
|
|
||||||
|
|
||||||
__set_PATH() {
|
|
||||||
local path paths=("$HOME"/bin {/usr{/local,},}/{,s}bin)
|
|
||||||
printf -v path %s: "${paths[@]}"
|
|
||||||
export PATH=${path%:}
|
|
||||||
}
|
|
||||||
|
|
||||||
__set_ENV() {
|
|
||||||
local var
|
|
||||||
|
|
||||||
declare -A env=(
|
|
||||||
[EDITOR]=nano
|
|
||||||
[PAGER]=less
|
|
||||||
[LESSHISTFILE]=-
|
|
||||||
[HISTCONTROL]=ignoreboth
|
|
||||||
)
|
|
||||||
|
|
||||||
for var in "${!env[@]}"; do
|
|
||||||
export "$var"="${env[$var]}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
__set_SHOPTS() {
|
|
||||||
local shopts=(
|
|
||||||
{null,ext,dot}glob globstar cmdhist
|
|
||||||
hostcomplete checkwinsize checkhash
|
|
||||||
)
|
|
||||||
|
|
||||||
shopt -s "${shopts[@]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
__set_PATH
|
|
||||||
__set_ENV
|
|
||||||
__set_SHOPTS
|
|
||||||
|
|
||||||
ulimit -c unlimited
|
|
||||||
|
|
||||||
###
|
|
||||||
# Search Path Manager
|
|
||||||
###
|
|
||||||
|
|
||||||
add_path() {
|
|
||||||
local path paths path_list=( )
|
|
||||||
declare -A uniq_paths
|
|
||||||
IFS=: read -ra paths <<< "$PATH"
|
|
||||||
|
|
||||||
for path in "$@" "${paths[@]}"; do
|
|
||||||
if [[ ! -v uniq_paths[$path] ]]; then
|
|
||||||
uniq_paths[$path]=42
|
|
||||||
path_list+=("$path")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
printf -v path %s: "${path_list[@]}"
|
|
||||||
export PATH=${path%:}
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Library loader
|
|
||||||
###
|
|
||||||
|
|
||||||
for dot in ~/bin/dotlib/*.sh; do
|
|
||||||
. "$dot"
|
|
||||||
done
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Nick Chambers <uplime@spookyinternet.com>
|
Copyright (c) <year> <copyright holders>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -1,9 +0,0 @@
|
||||||
install: ~/.bash_profile ~/.bashrc
|
|
||||||
mkdir -p ~/bin/dotlib
|
|
||||||
cp -r dotlib/*.sh ~/bin/dotlib
|
|
||||||
|
|
||||||
~/.bash_profile: .bash_profile
|
|
||||||
cp -f .bash_profile ~/.bash_profile
|
|
||||||
|
|
||||||
~/.bashrc: .bashrc
|
|
||||||
cp -f .bashrc ~/.bashrc
|
|
|
@ -1,4 +0,0 @@
|
||||||
export HOMEBREW_NO_AUTO_UPDATE=grrr
|
|
||||||
export HOMEBREW_NO_ANALYTICS=lol
|
|
||||||
export HOMEBREW_NO_ENV_HINTS=thunderfury
|
|
||||||
export HOMEBREW_NO_INSECURE_REDIRECT=pirates
|
|
|
@ -1,50 +0,0 @@
|
||||||
read -r month day < <(date "+%m %d")
|
|
||||||
|
|
||||||
if (( 10#$month == 3 && 10#$day < 18 )); then
|
|
||||||
if (( 17 - 10#$day == 0 )); then
|
|
||||||
printf "Happy Saint Patrick's day!\n"
|
|
||||||
else
|
|
||||||
printf "Only %d days left until Saint Patrick's day!\n" "$(( 17 - 10#$day ))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
holiday=🍀
|
|
||||||
elif (( 10#$month == 10 )); then
|
|
||||||
if (( 31 - 10#$day == 0 )); then
|
|
||||||
printf 'Have a spooky halloween!\n'
|
|
||||||
else
|
|
||||||
printf 'Only %d days left until Halloween!\n' "$(( 31 - 10#$day ))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
holiday=🎃
|
|
||||||
elif (( 10#$month == 12 && 10#$day < 26 )); then
|
|
||||||
if (( 25 - 10#$day == 0 )); then
|
|
||||||
printf 'Merry Christmas!\n'
|
|
||||||
else
|
|
||||||
printf 'Only %d days left until Christmas!\n' "$(( 25 - 10#$day ))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
holiday=🌲
|
|
||||||
fi
|
|
||||||
|
|
||||||
setup-prompt() {
|
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
if [[ -d .git ]]; then
|
|
||||||
git_branch=" $(command git branch --show-current)"
|
|
||||||
else
|
|
||||||
git_branch=
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
PROMPT_COMMAND=setup-prompt
|
|
||||||
PS1='\w$git_branch'
|
|
||||||
|
|
||||||
if [[ -v SSH_CLIENT ]]; then
|
|
||||||
if [[ -v HOSTNAME ]]; then
|
|
||||||
PS1+=' $HOSTNAME'
|
|
||||||
else
|
|
||||||
PS1+=' $(hostname)'
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
PS1+=' ${holiday-λ} '
|
|
|
@ -1,4 +0,0 @@
|
||||||
if [[ -d ~/.rvm && -s ~/.rvm/scripts/rvm ]]; then
|
|
||||||
. ~/.rvm/scripts/rvm
|
|
||||||
add_path ~/.rvm/bin
|
|
||||||
fi
|
|
|
@ -1,37 +0,0 @@
|
||||||
_ssh_hosts() {
|
|
||||||
mapfile -t hosts < <(awk 'tolower($1) == "host" { print $2 }' ~/.ssh/config)
|
|
||||||
mapfile -t COMPREPLY < <(compgen -W "${hosts[*]}" -- "${COMP_WORDS[COMP_CWORD]}")
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -F _ssh_hosts ssh scp ssh-copy-id sftp
|
|
||||||
|
|
||||||
_make_targets() {
|
|
||||||
local arg prev file targets
|
|
||||||
|
|
||||||
if [[ -f makefile ]]; then
|
|
||||||
file=makefile
|
|
||||||
elif [[ -f Makefile ]]; then
|
|
||||||
file=Makefile
|
|
||||||
fi
|
|
||||||
|
|
||||||
for arg in "${COMP_WORDS[@]}"; do
|
|
||||||
if [[ $prev = -f ]]; then
|
|
||||||
file=$arg
|
|
||||||
elif [[ $arg = -f* ]]; then
|
|
||||||
file=${arg#-f}
|
|
||||||
fi
|
|
||||||
|
|
||||||
prev=$arg
|
|
||||||
done
|
|
||||||
|
|
||||||
mapfile -t targets < <(
|
|
||||||
awk '$1 ~ /:$/ && $1 !~ /^\./ { gsub(/:$/, "", $1); print $1 }' "$file"
|
|
||||||
)
|
|
||||||
|
|
||||||
mapfile -t COMPREPLY < <(
|
|
||||||
compgen -W "${targets[*]}" -- "${COMP_WORDS[COMP_CWORD]}"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -o default -F _make_targets make gmake
|
|
|
@ -1,24 +0,0 @@
|
||||||
###
|
|
||||||
# Utilities
|
|
||||||
###
|
|
||||||
|
|
||||||
ll() {
|
|
||||||
command ls -AlF "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh() {
|
|
||||||
TERM=xterm-256color command ssh "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
awk-find() {
|
|
||||||
if (( $# > 1 )); then
|
|
||||||
local find_in=${TO_FIND:-.} file pattern=$1 to_find=( )
|
|
||||||
|
|
||||||
for file in "${@:2}"; do
|
|
||||||
to_find+=(-name "$file" -o)
|
|
||||||
done
|
|
||||||
|
|
||||||
find "$find_in" -not -name . "(" "${to_find[@]::${#to_find[@]} - 1}" ")" -print0 |
|
|
||||||
awk -F / -v RS="\0" "$pattern"
|
|
||||||
fi
|
|
||||||
}
|
|
Loading…
Reference in a new issue