From cffe18cb65fa5c05dda820f5c533e3816d38cf4f Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 11 Oct 2024 00:44:03 -0400 Subject: [PATCH] HIST_IGNORE_SPACE, add yt-best function --- fake_home/.shell_aliases | 88 ++++++++++++++++++++++++---------------- fake_home/.zshrc | 1 + 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/fake_home/.shell_aliases b/fake_home/.shell_aliases index c6e5a36..eaba615 100755 --- a/fake_home/.shell_aliases +++ b/fake_home/.shell_aliases @@ -85,22 +85,6 @@ function cache-run { alias cr='cache-run' -function roll { - local count=1 - if [[ "$2" != "" ]]; then - count="$2" - fi - local rolls="$(shuf -i 1-$1 -n $count)" - echo "$rolls" | toilet - for i in {1..$count}; do - setsid cvlc --play-and-exit $HOME/Videos/roll.mp3 &> /dev/null - sleep "0.0$(shuf -i 5-9 -n 1)" - done - if [[ "$count" != "1" ]]; then - echo "Total: $(echo "$rolls" | paste -s -d+ - | bc)" | toilet - fi -} - function arr { local json="[" for var in "$@" @@ -112,24 +96,6 @@ function arr { echo "$json" | jq --indent 0 } -alias d4='roll 4' -alias 4='roll 4' - -alias d6='roll 6' -alias 6='roll 6' - -alias d8='roll 8' -alias 8='roll 8' - -alias d10='roll 10' -alias 10='roll 10' - -alias d12='roll 12' -alias 12='roll 12' - -alias d20='roll 20' -alias 20='roll 20' - alias dedup="awk '!seen_lines[$0]++'" alias dedup-keep-last="tac | awk '!seen_lines[$0]++' | tac" @@ -253,6 +219,10 @@ function undelete { git checkout $hash -- "$filename" } +function mcd { + mkdir -p "$1" && cd "$1" +} + alias j='journalctl -xefu' alias hsearch='hearch' alias d='docker' @@ -355,6 +325,11 @@ alias yt='yt-dlp' function y { cd ~/.ytdl; yt-dlp $@; cd - } +function yt-best { + while ! yt-dlp -f "bestvideo+bestaudio[ext=m4a]/best" $@; do + sleep 5; + done +} # Mkdir should remind you to use git alias mkdir="echo 'Maybe use git init if this is a new project' && mkdir" @@ -419,6 +394,51 @@ alias du='du -sh' alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags' +function roll { + local count=1 + if [[ "$2" != "" ]]; then + count="$2" + fi + local rolls="$(shuf -i 1-$1 -n $count)" + echo "$rolls" | toilet + for i in {1..$count}; do + setsid cvlc --play-and-exit $HOME/Videos/roll.mp3 &> /dev/null + sleep "0.0$(shuf -i 5-9 -n 1)" + done + if [[ "$count" != "1" ]]; then + echo "Total: $(echo "$rolls" | paste -s -d+ - | bc)" | toilet + fi +} + +function arr { + local json="[" + for var in "$@" + do + json="$json$(echo "$var" | jq -R)," + done + json=${json:0:-1} + json="$json]" + echo "$json" | jq --indent 0 +} + +alias d4='roll 4' +alias 4='roll 4' + +alias d6='roll 6' +alias 6='roll 6' + +alias d8='roll 8' +alias 8='roll 8' + +alias d10='roll 10' +alias 10='roll 10' + +alias d12='roll 12' +alias 12='roll 12' + +alias d20='roll 20' +alias 20='roll 20' + if [[ "$@" != "" ]]; then $@ fi diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 82a905c..b687797 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -14,6 +14,7 @@ HISTFILE=~/.histfile HISTSIZE=SAVEHIST=100000000 setopt appendhistory autocd notify setopt menu_complete +setopt HIST_IGNORE_SPACE unsetopt beep bindkey -v