Commit 0606b46
xxwhirlpool
·
2025-06-10 10:20:00 -0400 EDT
parent ed5289c
more bashrc snippets
2 files changed,
+55,
-0
+17,
-0
| ... | ... | @@ -19,3 +21,18 @@ cdmess() { | |
| 19 | 21 | mkdir -p "$today_tmpdir" | |
| 20 | 22 | cd "$(mktemp -d -p "${today_tmpdir}" XXXX)" | |
| 21 | 23 | } | |
| 24 | + | ||
| 25 | + | # don't log commands that start with a space | |
| 26 | + | export HISTCONTROL=ignorespace | |
| 27 | + | ||
| 28 | + | # fuzzy find/search thru (recent) bash history | |
| 29 | + | hist() { | |
| 30 | + | cat ~/.bash_history | fzf | sh | |
| 31 | + | } | |
| 32 | + | ||
| 33 | + | # catppuccin colors for fzf | |
| 34 | + | export FZF_DEFAULT_OPTS=" \ | |
| 35 | + | --color=spinner:#F2D5CF,hl:#E78284 \ | |
| 36 | + | --color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \ | |
| 37 | + | --color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \ | |
| 38 | + | --color=border:#414559,label:#C6D0F5" |
+38,
-0
| ... | ... | @@ -0,0 +1,38 @@ | |
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | cdmess() { | |
| 4 | + | # from this blog post: | |
| 5 | + | # | |
| 6 | + | # https://blog.larah.me/mess-directory/ | |
| 7 | + | # | |
| 8 | + | today_tmpdir="${TMPDIR-/tmp}/${USER}_mess/$(date +%F)" | |
| 9 | + | mkdir -p "$today_tmpdir" | |
| 10 | + | cd "$(mktemp -d -p "${today_tmpdir}" XXXX)" | |
| 11 | + | } | |
| 12 | + | ||
| 13 | + | # don't log commands that start with a space | |
| 14 | + | export HISTCONTROL=ignorespace | |
| 15 | + | ||
| 16 | + | # fuzzy find/search thru (recent) bash history | |
| 17 | + | hist() { | |
| 18 | + | cat ~/.bash_history | fzf | sh | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | # catppuccin colors for fzf | |
| 22 | + | export FZF_DEFAULT_OPTS=" \ | |
| 23 | + | --color=spinner:#F2D5CF,hl:#E78284 \ | |
| 24 | + | --color=fg:#C6D0F5,header:#E78284,info:#CA9EE6,pointer:#F2D5CF \ | |
| 25 | + | --color=marker:#BABBF1,fg+:#C6D0F5,prompt:#CA9EE6,hl+:#E78284 \ | |
| 26 | + | --color=border:#414559,label:#C6D0F5" | |
| 27 | + | ||
| 28 | + | # get a random free port. this is useful for my | |
| 29 | + | # insane sysadmin website woman adventures | |
| 30 | + | portfree() { | |
| 31 | + | while | |
| 32 | + | port=$(shuf -n 1 -i 49152-65535) | |
| 33 | + | netstat -atun | grep -q "$port" | |
| 34 | + | do | |
| 35 | + | continue | |
| 36 | + | done | |
| 37 | + | echo "$port" | |
| 38 | + | } |