dots


dots / config
xxwhirlpool  ·  2026-05-09

.bashrc-mariposa

  1#!/bin/bash
  2# ~/.bashrc: executed by bash(1) for non-login shells.
  3# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  4# for examples
  5
  6######################################
  7# default stuff i'm scared to change
  8######################################
  9
 10# If not running interactively, don't do anything
 11case $- in
 12    *i*) ;;
 13      *) return;;
 14esac
 15
 16HISTCONTROL=ignoreboth
 17
 18# append to the history file, don't overwrite it
 19shopt -s histappend
 20
 21HISTSIZE=1000
 22HISTFILESIZE=2000
 23
 24# check the window size after each command and, if necessary,
 25# update the values of LINES and COLUMNS.
 26shopt -s checkwinsize
 27
 28# make less more friendly for non-text input files, see lesspipe(1)
 29[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
 30
 31# set variable identifying the chroot you work in (used in the prompt below)
 32if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
 33    debian_chroot=$(cat /etc/debian_chroot)
 34fi
 35
 36# set a fancy prompt (non-color, unless we know we "want" color)
 37case "$TERM" in
 38    xterm-color|*-256color) color_prompt=yes;;
 39esac
 40
 41if [ -n "$force_color_prompt" ]; then
 42    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
 43	color_prompt=yes
 44    else
 45	color_prompt=
 46    fi
 47fi
 48
 49if [ "$color_prompt" = yes ]; then
 50    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 51else
 52    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 53fi
 54unset color_prompt force_color_prompt
 55
 56# If this is an xterm set the title to user@host:dir
 57case "$TERM" in
 58xterm*|rxvt*)
 59    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
 60    ;;
 61*)
 62    ;;
 63esac
 64
 65# enable color support of ls and also add handy aliases
 66if [ -x /usr/bin/dircolors ]; then
 67    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
 68    alias ls='ls --color=auto'
 69    alias grep='grep --color=auto'
 70fi
 71
 72# enable programmable completion features (you don't need to enable
 73# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
 74# sources /etc/bash.bashrc).
 75if ! shopt -oq posix; then
 76  if [ -f /usr/share/bash-completion/bash_completion ]; then
 77    . /usr/share/bash-completion/bash_completion
 78  elif [ -f /etc/bash_completion ]; then
 79    . /etc/bash_completion
 80  fi
 81fi
 82
 83######################################
 84# aliases
 85######################################
 86
 87# general
 88
 89alias icat="kitten icat"
 90alias fd="fdfind"
 91alias neofetch="hyfetch"
 92alias fastfetch="hyfetch"
 93alias bat="batcat"
 94alias cat="bat --paging=never"
 95alias rced="micro ~/.bashrc && source ~/.bashrc"
 96alias ps="ps auxww"
 97alias dd="askdd"
 98alias copy="xclip -sel clipboard"
 99alias open="xdg-open"
100alias c="clear"
101alias updupgr="sudo apt update && sudo apt upgrade"
102alias freeze="freeze -c user"
103alias glow="glow -p"
104alias unfuckwifi="sudo systemctl restart NetworkManager"
105alias uptime="uptime -p"
106alias irc="senpai"
107alias xmpp="profanity"
108
109# some cd bookmarks
110alias dotf="cd /home/kat/dotfiles"
111alias gmine="cd /home/kat/Projects/mine"
112alias scr="cd /home/kat/Scripts"
113
114# weather stuff
115alias wttr="curl https://wttr.in/nyc?F0ASu"
116alias weather=wttr
117alias wttrlg="curl https://wttr.in/nyc?F1uq"
118alias weatherlg=wttrlg
119alias sun="daylight --short --timezone='America/New_York' | lolcat"
120
121# git
122alias gitall="git remote | xargs -L1 git push --all"
123alias gyolo="git add . && git commit -m 'yolo'"
124alias gitd="git diff --staged"
125alias gitlc="git diff HEAD~"
126alias gdiff="gitd"
127alias gits="git status"
128alias gita="git add ."
129alias pusheu="git push bytes main && cd /home/kat/Projects/mine/eunoia-astro/src/utils && node git-changelog.js && cd ../../"
130
131# dev
132alias irb="rv run irb"
133alias ipy="python3 -i"
134
135# vpn split tunnel aliases based on a small script @ ~/.local/bin/mvpn
136alias mftp="mvpn filezilla"
137alias mterm="mvpn kitty"
138
139# servers
140alias fujo="kitty +kitten ssh fujo"
141alias fujobuild="kitty +kitten ssh fujobuild"
142alias fujohost="kitty +kitten ssh fujohost"
143alias fujoat="kitty +kitten ssh fujoat"
144alias goldstar="kitty +kitten ssh goldstar"
145alias ncc="kitty +kitten ssh ncc1701"
146
147######################################
148# variables
149######################################
150
151export PATH=$PATH:/usr/local/go/bin
152
153export NVM_DIR="$HOME/.config/nvm"
154[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
155[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
156
157# set truecolor
158export COLORTERM=truecolor
159export MICRO_TRUECOLOR=1
160
161# catppuccin colors for fzf
162export FZF_DEFAULT_OPTS=" \
163--color=spinner:#F2D5CF,hl:#E78284 \
164--color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \
165--color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \
166--color=border:#414559,label:#C6D0F5"
167
168export FZF_CTRL_T_OPTS="
169  --walker-skip .git,node_modules,target
170  --preview 'batcat -n --color=always {}'
171  --bind 'ctrl-/:change-preview-window(down|hidden|)'"
172
173export FZF_ALT_C_OPTS="
174  --walker-skip .git,node_modules,target
175  --preview 'tree -C {}'"
176
177export LEDGER_FILE=~/.config/hledger/katmoney.journal
178
179######################################
180# functions
181######################################
182
183# get a random free port. this is useful for my
184# insane sysadmin website woman adventures
185portfree() {
186	while
187		port=$(shuf -n 1 -i 1024-65535)
188		netstat -atun | grep -q "$port"
189	do
190		continue
191	done
192	echo -n "$port"
193}
194
195# print internal & external IPs
196whatip() {
197	# internal
198	echo -n "internal IP: " | lolcat -p 0.7
199	hostname -I | awk '{print $1}'
200
201	# external
202	echo -n "external IP: " | lolcat -p 0.7
203	curl -4 icanhazip.com
204}
205
206# password generator. takes input for password length by number
207passgen() {
208	PASSLENGTH=$(gum input --placeholder "type a number")
209	date +%s | sha256sum | base64 | head -c "$PASSLENGTH"; echo
210}
211
212cdmess() {
213	# from this blog post:
214	# https://blog.larah.me/mess-directory/
215	today_tmpdir="${TMPDIR-/tmp}/${USER}_mess/$(date +%F)"
216	mkdir -p "$today_tmpdir"
217	cd "$(mktemp -d -p "${today_tmpdir}" XXXX)" || exit 1
218}
219
220# to get quick notifs
221# after long commands
222notif() {
223	notify-send "done!"
224	paplay /usr/share/sounds/sound-icons/start
225	spd-say -t female3 -r +25 "done!"
226}
227
228# make & cd into a folder
229mkcd() {
230  mkdir -p "$@" && cd "$_" || exit 1;
231}
232
233# shamelessly stolen from evan hahn:
234# https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/#audio-and-video-and-pictures
235boop() {
236	local last="$?"
237	if [[ "$last" == "0" ]]; then
238		sfx chime
239	else
240		sfx bad
241	fi
242	exit "$last"
243}
244
245# man by default, fall back to `help`
246# for shell functions
247# https://lobste.rs/s/fkr3ha/some_terminal_frustrations#c_70wike
248man() {
249	/usr/bin/man "$@" || help "$@" | less
250}
251
252# https://askubuntu.com/questions/196890/how-to-find-the-bitrate-of-an-mp3-file-via-command-line
253bitrate() {
254	gum style --foreground "#f4b8e4" "file: " | tr -d "\n"
255	basename "$1"
256	gum style --foreground "#f4b8e4" "bitrate: " | tr -d "\n"
257	echo "$(file "$1" | sed 's/.*, \(.*\)kbps.*/\1/' | tr -d " " )" kbps
258}
259
260######################################
261# misc
262######################################
263
264eval "$(starship init bash)"
265eval "$(fzf --bash)"
266eval "$(batman --export-env)"
267. "/home/kat/.deno/env"
268
269eval "$(/home/kat/.cargo/bin/rv shell init bash)"
270eval "$(/home/kat/.cargo/bin/rv shell completions bash)"
271
272if command -v zmx &> /dev/null; then
273  eval "$(zmx completions bash)"
274fi