aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/.profile15
-rw-r--r--sh/bash/.bash_profile53
-rw-r--r--sh/bash/.bashrc167
3 files changed, 235 insertions, 0 deletions
diff --git a/sh/.profile b/sh/.profile
new file mode 100644
index 0000000..99da34c
--- /dev/null
+++ b/sh/.profile
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+#
+# bryson's shell-agnostic profile
+#
+
+# shell variables
+PATH=$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$HOME/.dotnet/tools:$HOME/bin:$HOME/.config/emacs/bin:$PATH
+EDITOR=/usr/bin/vim
+TERMINAL=/usr/bin/alacritty
+BROWSER=/usr/bin/librewolf-bin
+XZ_OPT='-9 -T0 -M 32000000000'
+DOTNET_CLI_TELEMETRY_OPTOUT="true"
+
+# finally export all variables
+export PATH EDITOR TERMINAL BROWSER XZ_OPT DOTNET_CLI_TELEMETRY_OPTOUT
diff --git a/sh/bash/.bash_profile b/sh/bash/.bash_profile
new file mode 100644
index 0000000..d2d4cc3
--- /dev/null
+++ b/sh/bash/.bash_profile
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+#
+# bryson's bash profile
+#
+
+# import shell-agnostic profile
+if [ -f ~/.profile ]; then
+ . ~/.profile
+fi
+
+# import global bashrc
+if [ -f /etc/bashrc ]; then
+ . /etc/bashrc
+fi
+
+# if login shell, run tty menu
+if [[ $TERM == 'linux' ]]; then
+ while true; do
+ echo -e "\e[0;35m***** MAIN MENU *****\e[0m"
+ echo "1: Start XMonad"
+ echo "2: Exit to Bash"
+ echo -e "\e[0;35m---\e[0m"
+ echo "8: Logout"
+ echo "9: Reboot"
+ echo "0: Shutdown"
+ read -rs -N 1 key
+ case $key in
+ 1) startx ;;
+ 2) break ;;
+ 8) logout ;;
+ 9) echo "Are you sure you want to reboot? (y will reboot)";
+ read -rs -N 1 confirm; [ "$confirm" = 'y' ] && (doas reboot; break) ;;
+ 0) echo "Are you sure you want to shutdown? (y will shutdown)";
+ read -rs -N 1 confirm; [ "$confirm" = 'y' ] && (doas reboot; break) ;;
+ esac
+ done
+fi
+# end tty menu
+
+# bash specific variables
+HISTSIZE=100000
+
+# enable command completion for doas
+complete -cf doas
+shopt -s expand_aliases
+
+# export variables
+export HISTSIZE black BLACK dgray DGRAY red RED lred LRED green GREEN lgreen LGREEN yellow LYELLOW blue BLUE lblue LBLUE magenta MAGENTA lmagenta LMAGENTA cyan CYAN lcyan LCYAN lgray LGRAY NC
+
+# import bashrc
+# if [ -f ~/.bashrc ]; then
+# . ~/.bashrc
+# fi
diff --git a/sh/bash/.bashrc b/sh/bash/.bashrc
new file mode 100644
index 0000000..1315e51
--- /dev/null
+++ b/sh/bash/.bashrc
@@ -0,0 +1,167 @@
+#!/usr/bin/env bash
+#
+# bryson's bashrc
+#
+
+### aliases ###
+alias sudo="doas"
+
+# typos
+alias l='ls'
+alias sl='ls'
+
+# always run with args
+alias grep='grep --color=auto'
+alias fgrep='fgrep --color=auto'
+alias egrep='egrep --color=auto'
+alias ls='ls --color=auto'
+alias la='ls -a'
+alias ll='ls -lh'
+alias lla='ls -lha'
+alias cp='cp -iv'
+alias mv='mv -iv'
+alias rm='rm -vI'
+alias diff='diff --color=auto'
+alias g++='g++ --std=c++20'
+alias vim='vim -p'
+alias gs='gs -dNOSAFER'
+alias emacsclient='emacsclient -cn'
+
+# cd shortcuts
+alias ..='cd ..'
+alias ...='cd ../..'
+alias ....='cd ../../..'
+alias b='cd -'
+
+# copy an entire file
+alias copy='xclip -sel c <'
+
+# binary substitutions
+# alias ed='fzf --height=15 --layout=reverse | sed "s/^/\"/g;s/$/\"/g" | xargs -ro vim'
+
+# common combinations
+alias dj='python manage.py'
+alias smci='sudo make clean install'
+alias smi='sudo make install'
+alias lib='xrandr --output HDMI-A-0 --auto --output eDP --off && xset r rate 300 50 && feh --bg-fill ~/Pictures/Wallpapers/solid-gruvbox-2.png && xmodmap ~/.Xmodmap'
+alias laptop='xrandr --output HDMI-A-0 --off --output eDP --auto && feh --bg-fill ~/Pictures/Wallpapers/solid-gruvbox-2.png'
+alias mirror='xrandr --output HDMI-A-0 --auto && feh --bg-fill ~/Pictures/Wallpapers/solid-gruvbox-2.png && xmodmap ~/.Xmodmap'
+alias hgrep='history | grep'
+alias keys='xset r rate 300 50'
+alias gits='git status'
+alias mac="rm -rf __MACOSX/; rm \$(find . -name '.DS_Store')"
+
+# fixes
+alias fixwifi='sudo rc-service wpa_supplicant restart'
+alias fixaudio='pacmd set-default-sink alsa_output.usb-0c76_USB_PnP_Audio_Device-00.analog-stereo'
+alias fixjava='export _JAVA_AWT_WM_NONREPARENTING=1 && export AWT_TOOLKIT=MToolkit && wmname LG3D'
+alias fixkeb='xmodmap ~/.Xmodmap ; xset r rate 200 80 '
+
+# auto elevate
+alias mount='sudo mount'
+alias umount='sudo umount'
+
+# other garbage
+alias server="python3 /home/bryson/git/webserver/server.py"
+
+### colors ###
+# capitals are bold
+# 'l' is 'light'
+# 'd' is 'dark'
+black='\e[0;30m'
+BLACK='\e[1;30m'
+dgray='\e[0;90m'
+DGRAY='\e[1;90m'
+red='\e[0;31m'
+RED='\e[1;31m'
+lred='\e[0;91m'
+LRED='\e[1;91m'
+green='\e[0;32m'
+GREEN='\e[1;32m'
+lgreen='\e[0;92m'
+LGREEN='\e[1;92m'
+yellow='\e[0;33m'
+YELLOW='\e[1;33m'
+lyellow='\e[0;93m'
+LYELLOW='\e[1;93m'
+blue='\e[0;34m'
+BLUE='\e[1;34m'
+lblue='\e[0;94m'
+LBLUE='\e[1;94m'
+magenta='\e[0;35m'
+MAGENTA='\e[1;35m'
+lmagenta='\e[0;95m'
+LMAGENTA='\e[1;95m'
+cyan='\e[0;36m'
+CYAN='\e[1;36m'
+lcyan='\e[0;96m'
+LCYAN='\e[1;96m'
+lgray='\e[0;37m'
+LGRAY='\e[1;37m'
+NC='\e[0m' # No Color
+
+### functions galore! ###
+# upload item to webserver
+function upload() {
+ scp $1 paul:/home/PUBLIC/upload && echo https://brysonsteck.xyz/pub/upload/$(echo $1 | rev | cut -d '/' -f 1 | rev)
+}
+
+# return exit code of last program if not 0
+function exit_code() {
+ local ERROR="$?"
+ if [[ ERROR -ne 0 ]]; then
+ # echo -n ''"$dgray"'\]/\['"$RED"'\]'"$ERROR"'\['"$dgray"'\]\\'
+ echo -n '\['"$dgray"'\]<\['"$RED"'\]'"$ERROR"'\['"$dgray"'\]> '
+ # else
+ # # echo -n ''"$dgray"'\]/\['"$LBLUE"'\]'"$ERROR"'\['"$dgray"'\]\\'
+ # echo -n '\['"$RED"'\]'"$ERROR"' '
+ fi
+}
+
+# get current git branch and status
+# http://www.opinionatedprogrammer.com/2011/01/colorful-bash-prompt-reflecting-git-status/
+function _git_prompt() {
+ local git_status="`git status -unormal 2>&1`"
+ if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
+ if [[ "$git_status" =~ nothing\ to\ commit ]]; then
+ local ansi=""
+ local color="$lcyan"
+ elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
+ local ansi="!"
+ local color="$lred"
+ else
+ local ansi="*"
+ local color="$lyellow"
+ fi
+ if [[ "$git_status" =~ On\ branch\ ([^[:space:]]+) ]]; then
+ branch=${BASH_REMATCH[1]}
+ else
+ # Detached HEAD. (branch=HEAD is a faster alternative.)
+ branch="`git describe --all --contains --abbrev=4 HEAD 2> /dev/null ||
+ echo local`"
+ fi
+ if ! [[ "$branch" =~ local ]]; then
+ # echo -n '\['"$color"'\] ('"$ansi"''"$branch"') '
+ echo -n '\['"$dgray"'\](\['"$color"'\]'"$branch"''"$ansi"'\['"$dgray"'\])'
+ fi
+ fi
+}
+
+export -f exit_code
+export -f _git_prompt
+
+### shell prompt ###
+# bryson@hostname [/current/path] {12:00:00} <255> (master)
+# $
+export _PS1="\[$LCYAN\]\u\[$dgray\]@\[$LGREEN\]\h \[$dgray\][\[$YELLOW\]\w\[$dgray\]] {\[$LBLUE\]\@\[$dgray\]} "
+
+# define x titlebar
+TITLEBAR='\[\033]0;\u@\h \w\]'
+
+# apply prompt and functions
+# ignore titlebar if xterm, likely don't need a title anyway
+if [[ "$TERM" =~ xterm-256color ]]; then
+ export PROMPT_COMMAND='export PS1="${_PS1}$(exit_code)$(_git_prompt)\n\[$NC\]\$ ";echo'
+else
+ export PROMPT_COMMAND='export PS1="$TITLEBAR${_PS1}$(exit_code)$(_git_prompt)\n\[$LGRAY\]\$\[$NC\] ";echo'
+fi