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

63
bash/.aliases Normal file
View File

@@ -0,0 +1,63 @@
# Custom Bash Aliases
## system services
alias restart="sudo systemctl restart"
alias status="sudo systemctl status"
## navigation
alias ..='cd ..'
alias ...='cd ../../'
alias ....='cd ../../../'
## system information
alias connections="sudo netstat -tunlp"
alias ports='netstat -tulanp'
alias path='echo -e ${PATH//:/\\n}'
alias free='free -m -l -t'
alias psmem='ps auxf | sort -nr -k 4 | head -10'
alias pscpu='ps auxf | sort -nr -k 3 | head -10'
## system logs
alias logtail="tail -n 200 /var/log/syslog"
## system administration
alias upgrade="sudo apt update && sudo apt upgrade -y"
alias syscat='systemctl cat'
alias sysls='systemctl list-unit-files --type=service --state=enabled'
alias syslsa='systemctl list-unit-files --type=service'
## safe defaults
alias rm='rm -I --preserve-root'
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
## apps
alias g='git'
alias bat='batcat'
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
## text editing
alias edit="emacs $1"
alias sedit="sudo emacs $1"
## ls helpers
alias l="ls -lF --color"
alias la="ls -AF --color" # exclude . and ..
alias lsd="ls -F --color | grep --color=never '^d'" # only directories
alias ls="command ls --color" # always color
alias ll="ls -AlFh --color"
# always enable colored `grep` output
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
## misc utils
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias ping='ping -c 5'
alias reload="exec ${SHELL} -l" # reload the shell

39
bash/.bash_profile Normal file
View File

@@ -0,0 +1,39 @@
# .bash_profile
# Adrian Abeyta <adrian@adrianabeyta.com>
# 2026.04.05
# don't do anything if not running interactively
case $- in
*i*) ;;
*) return;;
esac
# include user home bins if they exist
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi;
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi;
# load the dotfiles
for file in ~/.{env,path,functions,aliases,prompt}; do
[ -r "$file" ] && [ -f "$file" ] && \
source "$file";
done;
unset file;
# fun scripts
if is_true "${HAVE_FUN:-}"; then
source ~/.fun
fi
shopt -s nocaseglob; # case-insensitive globbing
shopt -s histappend; # append to bash history file
shopt -s cdspell; # autocorrect typos in path names when cd'ing
shopt -s checkwinsize # update col/line values on each command
# enable tab completion for 'g' by marking as alias for 'git'
if type _git &> /dev/null; then
complete -o default -o nospace -F _git g;
fi;

43
bash/.bash_profile~ Normal file
View File

@@ -0,0 +1,43 @@
# .bash_profile
# Adrian Abeyta <adrian@adrianabeyta.com>
# 2026.04.05
# don't do anything if not running interactively
case $- in
*i*) ;;
*) return;;
esac
# include user home bins if they exist
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi;
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi;
# load the dotfiles
for file in ~/.{env,path,bash_prompt,aliases,functions}; do
[ -r "$file" ] && [ -f "$file" ] && \
source "$file";
done;
unset file;
# fun scripts
if is_true "${HAVE_FUN:-}"; then
source ~/.fun
fi
shopt -s nocaseglob; # case-insensitive globbing
shopt -s histappend; # append to bash history file
shopt -s cdspell; # autocorrect typos in path names when cd'ing
shopt -s checkwinsize # update col/line values on each command
# enable tab completion for 'g' by marking as alias for 'git'
if type _git &> /dev/null; then
complete -o default -o nospace -F _git g;
fi;
# startup oh-my-posh
OMP_THEME="~/.omp/themes/custom.json"
eval "$(oh-my-posh init bash --config $OMP_THEME)"

1
bash/.bashrc Normal file
View File

@@ -0,0 +1 @@
[ -n "$PS1" ] && source ~/.bash_profile;

23
bash/.env Normal file
View File

@@ -0,0 +1,23 @@
# .env Environment Variables and Settings
# Adrian Abeyta <adrian@adrianabeyta.com>
# Golang bin
export PATH=/usr/local/go/bin:$PATH
# Node.js
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# use bat(cat) for manpages
export MANPAGER="batcat -plman"
# don't put duplicate lines or lines starting with space in the history.
HISTCONTROL=ignoreboth
# history length/size
HISTSIZE=1000
HISTFILESIZE=2000
# enable fun scripts
#HAVE_FUN=true

61
bash/.functions Normal file
View File

@@ -0,0 +1,61 @@
# 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
}
## bash script helpers
is_true() {
case "${1,,}" in
1|true|yes|y|on) return 0 ;;
*) return 1 ;;
esac
}

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
}

5
bash/.prompt Normal file
View File

@@ -0,0 +1,5 @@
# Bash Prompt
# startup oh-my-posh
OMP_THEME="~/.omp/themes/custom.json"
eval "$(oh-my-posh init bash --config $OMP_THEME)"