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