From c58abab9e5f14fdabb1ea8b314c370fb515b7b69 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Wed, 26 Oct 2022 12:05:56 -0600 Subject: havent updated these in a while --- bash/.bash/00-global.bash | 2 +- bash/.bash/01-aliases.bash | 38 ++++++++++++++++++++++++++++---------- bash/.bash/02-prompt.bash | 19 ++++++++++++++----- bash/.bash/03-boot.bash | 30 ++++++++++++++++++++++++------ bash/.bash_profile | 8 ++++++-- bash/.bashrc | 5 +++-- 6 files changed, 76 insertions(+), 26 deletions(-) (limited to 'bash') diff --git a/bash/.bash/00-global.bash b/bash/.bash/00-global.bash index 38718fb..5ad99f7 100644 --- a/bash/.bash/00-global.bash +++ b/bash/.bash/00-global.bash @@ -5,7 +5,7 @@ # # expand history size -export HISTSIZE=5000 +export HISTSIZE=100000 # source global definitions if [ -f /etc/bashrc ]; then diff --git a/bash/.bash/01-aliases.bash b/bash/.bash/01-aliases.bash index 68ace42..87ae24f 100644 --- a/bash/.bash/01-aliases.bash +++ b/bash/.bash/01-aliases.bash @@ -6,6 +6,12 @@ shopt -s expand_aliases +alias sudo="doas" + +# typos +alias l='ls' +alias sl='ls' + # grep colors alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' @@ -26,14 +32,15 @@ alias ....='cd ../../..' alias back='cd -' # binary renames -alias java='/usr/java/jdk-17.0.1/bin/java' -alias java8='/usr/java/jre1.8.0_291/bin/java' -alias java12='/usr/java/jdk-12.0.2/bin/java' +alias java='/usr/local/java/jdk-18.0.1.1/bin/java' +alias java11='/usr/bin/java' alias python='python3' -#alias vim='nvim' +alias g++='g++ --std=c++20' +alias j='autojump' +alias vim='vim -p' # quick important file edits -alias todo='vim ~/TODO.md' +alias todo='vim ~/.todo/TODO.org' # go to directory with files from iPhone alias iPhone='cd /home/bryson/Downloads/from-iPhone' @@ -41,15 +48,26 @@ alias iPhone='cd /home/bryson/Downloads/from-iPhone' # common combinations alias gs='gs -dNOSAFER' alias django='python manage.py' -alias smci='sudo make clean install' -alias smi='sudo make install' -alias mount='sudo mount' -alias umount='sudo umount' +alias smci='doas make clean install' +alias smi='doas make install' +#alias mount='sudo mount' +#alias umount='sudo umount' # bash navigation alias add-alias='vim ~/.bash/01-aliases.bash; . ~/.bash_profile' +# common portage files +alias package.use='doas vim /etc/portage/package.use' +alias make.conf='doas vim /etc/portage/make.conf' +alias package.license='doas vim /etc/portage/package.license' + # other garbage -alias wifi='nmcli d wifi' +alias fixwifi='sudo rc-service wpa_supplicant restart' +#alias spt="spotifyd && spt" +alias macos="cd /home/bryson/git/macOS-Simple-KVM && ./basic.sh" +alias server="python3 /home/bryson/git/webserver/server.py" +alias ssh-pixel="ssh -p 8022 uO_14O@${1}" +alias emerge-update="sudo emerge --ask --verbose --update --deep --changed-use @world" +#alias vim="nvim" #alias connect='nmcli d wifi connect' #alias listwifi='nmcli d wifi list' diff --git a/bash/.bash/02-prompt.bash b/bash/.bash/02-prompt.bash index 45c7821..62f835a 100644 --- a/bash/.bash/02-prompt.bash +++ b/bash/.bash/02-prompt.bash @@ -3,6 +3,7 @@ # 02-prompt.bash # bryson's gnarly bash prompt config # +shopt -s histappend # color definitions black='\e[0;30m' @@ -47,7 +48,7 @@ color4='\e[38;5;226m' function exit_code() { local ERROR="$?" if [[ ERROR -ne 0 ]]; then - echo -n ' \['"$RED"'\]'"$ERROR"'' + echo -n '\['"$RED"'\]'"$ERROR"' ' fi } @@ -74,7 +75,7 @@ function _git_prompt() { echo local`" fi if ! [[ "$branch" =~ local ]]; then - echo -n '\['"$color"'\] { git: '"$ansi"''"$branch"' } ' + echo -n '\['"$color"'\] ('"$ansi"''"$branch"') ' fi fi } @@ -99,12 +100,20 @@ function _git_prompt() { # [ bryson@hostname path ] # $ -export _PS1="\[\e[$lgray\][ \[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\W \[$lgray\]]" -export _PS2="\[$dgray\]" +#export _PS1="\[\e[$lgray\][ \[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\W \[$lgray\]]" +#export _PS2="\[$dgray\]" + +#export _PS1="\[\e[$lgray\]\[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\W\[$lgray\]" + +# [ hostname ] Thu Mar 25, 10:00:00 AM, /dev/pts/0 +# { /current/path } 8 files, 64 KB (master) +# $ +export _PS1="\[$lgray\][ \[$LBLUE\]\h\[$lgray\] ] \[$LCYAN\]\d, \[$GREEN\]\T" +export _PS2="\[$lgray\]{ \[$LYELLOW\]\w\[$lgray\] }" # define x titlebar TITLEBAR='\[\033]0;\u@\h:\w ($(history 1 | cut -c 8-))\]' # apply prompt and functions -export PROMPT_COMMAND='export PS1="$TITLEBAR${_status}${_PS1}$(exit_code)$(_git_prompt)\n${_PS2}\[$NC\]\$ "' +export PROMPT_COMMAND='export PS1="$TITLEBAR$(exit_code)${_PS1}\n${_PS2}$(_git_prompt)\n\[$NC\]\$ ";history -a' diff --git a/bash/.bash/03-boot.bash b/bash/.bash/03-boot.bash index fd68025..6ea2c9d 100644 --- a/bash/.bash/03-boot.bash +++ b/bash/.bash/03-boot.bash @@ -2,31 +2,49 @@ # # 03-boot.bash # startup scripts for systems -# + +bat_check() { + TEST=$(acpi | grep "Dis") + + if [[ $? -eq 0 ]]; then + echo "***********************************************************" + echo " WARNING" + echo "***********************************************************" + echo "Power supply is not plugged in." + echo "Make sure it is plugged in to avoid a random shutdown." + read -rs -N 1 -p "Press [Enter] to continue, any other key to return..." input; + if grep -q "$input" <<< ""; then + echo "" + else + return 1 + fi + fi +} # run startup script if tty # for dingo if [[ $TERM == 'linux' && $(hostname) == 'dingo' ]]; then cat ~/bin/house.txt printf "\n${CYAN}Welcome back Bryson :)\n\n" - printf "${LGREEN}What should dingo do?\n${blue}" + printf "${LGREEN}What should dingo do?\n${magenta}" echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' while read -rs -N 1 key; do printf "${NC}" case $key in - d) startx ;; + d) bat_check && startx ;; n) nstartx.sh ;; q) echo "Are you sure you want to shutdown? (y/n)"; - read -rs -N 1 key2; case $key2 in y) shutdown now ;; esac; ;; + read -rs -N 1 key2; case $key2 in y) doas shutdown -Ph now ;; esac; ;; r) echo "Are you sure you want to reboot? (y/n)"; - read -rs -N 1 key3; case $key3 in y) reboot ;; esac; ;; + read -rs -N 1 key3; case $key3 in y) doas reboot ;; esac; ;; l) logout ;; b) break ;; [h?]) echo "$USAGE";; esac clear - printf "\n${red}Please try again...${NC}\n\n${LGREEN}What should dingo do now?\n${blue}" + cat ~/bin/house.txt + printf "\n${LGREEN}What should dingo do now?\n${magenta}" echo -e '\td: start docked\n\tn: start not docked\n\tq: shutdown\n\tr: reboot\n\tl: logout\n\tb: bash\n\n' done fi diff --git a/bash/.bash_profile b/bash/.bash_profile index 031ab84..e553530 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -1,12 +1,16 @@ # .bash_profile +PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin + # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs - -PATH=$PATH:$HOME/.local/bin:$HOME/bin +. /usr/share/autojump/autojump.bash export PATH +complete -cf doas +export PATH=$PATH:/home/bryson/.spicetify +#source "/home/bryson/git/emsdk/emsdk_env.sh" diff --git a/bash/.bashrc b/bash/.bashrc index 1a40fb5..c267237 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -4,10 +4,11 @@ if [[ -d ~/.bash/ ]]; then fi # install asdf -. $HOME/.asdf/asdf.sh -. $HOME/.asdf/completions/asdf.bash +#. $HOME/.asdf/asdf.sh +#. $HOME/.asdf/completions/asdf.bash # devkitpro DEVKITPRO=/opt/devkitpro DEVKITARM=/opt/devkitpro/devkitARM DEVKITPPC=/opt/devkitpro/devkitPPC +export PATH=$PATH:/home/bryson/.spicetify -- cgit v1.2.3