xxwhirlpool
·
2026-07-04
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 &>/dev/null"
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"
108alias email="neomutt"
109alias ip="ip -c"
110
111# some cd bookmarks
112alias dotf="cd /home/kat/dotfiles"
113alias gmine="cd /home/kat/Projects/mine"
114alias scr="cd /home/kat/Scripts"
115
116# weather stuff
117alias wttr="curl https://wttr.in/nyc?F0ASu"
118alias weather=wttr
119alias wttrlg="curl https://wttr.in/nyc?F1uq"
120alias weatherlg=wttrlg
121alias sun="daylight --short --timezone='America/New_York'"
122
123# git
124alias gitall="git remote | xargs -L1 git push --all"
125alias gyolo="git add . && git commit -m 'yolo'"
126alias gitd="git diff --staged"
127alias gitlc="git diff HEAD~"
128alias gdiff="gitd"
129alias gits="git status"
130alias gita="git add ."
131alias pusheu="git push bytes main && cd /home/kat/Projects/mine/eunoia-astro/src/utils && node git-changelog.js && cd ../../"
132
133# dev
134alias irb="rv run irb"
135alias ipy="python3 -i"
136
137# vpn split tunnel aliases based on a small script @ ~/.local/bin/mvpn
138alias mftp="mvpn filezilla"
139alias mterm="mvpn kitty"
140
141# servers
142alias fujo="kitty +kitten ssh fujo"
143alias fujobuild="kitty +kitten ssh fujobuild"
144alias fujohost="kitty +kitten ssh fujohost"
145alias fujoat="kitty +kitten ssh fujoat"
146alias goldstar="kitty +kitten ssh goldstar"
147alias ncc="kitty +kitten ssh ncc1701"
148
149######################################
150# variables
151######################################
152
153export PATH=$PATH:/usr/local/go/bin
154
155export NVM_DIR="$HOME/.config/nvm"
156[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
157[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
158
159# set truecolor
160export COLORTERM=truecolor
161export MICRO_TRUECOLOR=1
162
163# catppuccin colors for fzf
164export FZF_DEFAULT_OPTS=" \
165--color=spinner:#F2D5CF,hl:#E78284 \
166--color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \
167--color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \
168--color=border:#414559,label:#C6D0F5"
169
170export FZF_CTRL_T_OPTS="
171 --walker-skip .git,node_modules,target
172 --preview 'batcat -n --color=always {}'
173 --bind 'ctrl-/:change-preview-window(down|hidden|)'"
174
175export FZF_ALT_C_OPTS="
176 --walker-skip .git,node_modules,target
177 --preview 'tree -C {}'"
178
179export LEDGER_FILE=~/.config/hledger/katmoney.journal
180
181# perl shit
182PATH="/home/kat/.perl5/bin${PATH:+:${PATH}}"; export PATH;
183PERL5LIB="/home/kat/.perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
184PERL_LOCAL_LIB_ROOT="/home/kat/.perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
185PERL_MB_OPT="--install_base \"/home/kat/.perl5\""; export PERL_MB_OPT;
186PERL_MM_OPT="INSTALL_BASE=/home/kat/.perl5"; export PERL_MM_OPT;
187
188# golang shit
189export GOPATH="$HOME/.go"
190
191######################################
192# functions
193######################################
194
195# print internal & external IPs
196whatip() {
197 # internal
198 gum style --foreground 212 "internal IP: "
199 hostname -I | awk '{print $1}'
200
201 # external
202 gum style --foreground 212 "external IP: "
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
260portfree() {
261 while
262 port=$(shuf -n 1 -i 1024-65535)
263 netstat -atun | grep -q "$port"
264 do
265 continue
266 done
267 echo -n "$port"
268}
269
270######################################
271# misc
272######################################
273
274eval "$(starship init bash)"
275eval "$(fzf --bash)"
276eval "$(batman --export-env)"
277. "/home/kat/.deno/env"
278
279eval "$(/home/kat/.cargo/bin/rv shell init bash)"
280eval "$(/home/kat/.cargo/bin/rv shell completions bash)"
281
282if command -v zmx &> /dev/null; then
283 eval "$(zmx completions bash)"
284fi