HIST_IGNORE_SPACE, add yt-best function

This commit is contained in:
Sage Vaillancourt 2024-10-11 00:44:03 -04:00
parent d6af926afb
commit cffe18cb65
2 changed files with 55 additions and 34 deletions

View File

@ -85,22 +85,6 @@ function cache-run {
alias cr='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 { function arr {
local json="[" local json="["
for var in "$@" for var in "$@"
@ -112,24 +96,6 @@ function arr {
echo "$json" | jq --indent 0 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="awk '!seen_lines[$0]++'"
alias dedup-keep-last="tac | awk '!seen_lines[$0]++' | tac" alias dedup-keep-last="tac | awk '!seen_lines[$0]++' | tac"
@ -253,6 +219,10 @@ function undelete {
git checkout $hash -- "$filename" git checkout $hash -- "$filename"
} }
function mcd {
mkdir -p "$1" && cd "$1"
}
alias j='journalctl -xefu' alias j='journalctl -xefu'
alias hsearch='hearch' alias hsearch='hearch'
alias d='docker' alias d='docker'
@ -355,6 +325,11 @@ alias yt='yt-dlp'
function y { function y {
cd ~/.ytdl; yt-dlp $@; cd - 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 # Mkdir should remind you to use git
alias mkdir="echo 'Maybe use git init if this is a new project' && mkdir" 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' 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 if [[ "$@" != "" ]]; then
$@ $@
fi fi

View File

@ -14,6 +14,7 @@ HISTFILE=~/.histfile
HISTSIZE=SAVEHIST=100000000 HISTSIZE=SAVEHIST=100000000
setopt appendhistory autocd notify setopt appendhistory autocd notify
setopt menu_complete setopt menu_complete
setopt HIST_IGNORE_SPACE
unsetopt beep unsetopt beep
bindkey -v bindkey -v