This commit is contained in:
JMARyA 2024-03-02 22:33:55 +01:00
parent d0b88fbd2d
commit 580bf7c13b
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
7 changed files with 39 additions and 16 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
zsh/local.zsh

View file

@ -1,2 +0,0 @@
# print duration of video file
alias ffprobe_duration="ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1"

View file

@ -1,8 +1,17 @@
alias zshconfig="micro ~/.zshrc"
alias zshrefresh="source ~/.zshrc"
# rename <OLD> <NEW>
# rename files with replace pattern
function rename() {
rnr -f --no-dump "$1" "$2" ./*
rnr -f --no-dump "$1" "$2" ./*
}
alias cat="bat -p"
alias gfold="gfold -d classic"
alias gfold="gfold -d classic"
function hs() {
$(cat ~/.zsh_history|sk)
}
alias notes="codium ~/Notes"

View file

@ -1,18 +1,30 @@
# convert <OLD_EXT> <NEW_EXT>
# convert all files with old_ext to new_ext using ffmpeg
function convert() {
for i in *.$1; do ffmpeg -i "$i" "${i%.*}.$2"; done
for i in *.$1; do ffmpeg -i "$i" "${i%.*}.$2"; done
}
# remux all mkvs in current dir to mp4
function mkvToMp4() {
for i in *.mkv; do ffmpeg -i "$i" -map 0 -c copy "${i%.*}.mp4"; done
for i in *.mkv; do ffmpeg -i "$i" -map 0 -c copy "${i%.*}.mp4"; done
}
# print duration of video file
alias ffprobe_duration="ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1"
# duration EXT
# print duration of all files with .EXT
function duration() {
for i in *.$1
do
echo "$(ffprobe_duration $i) - $i"
done
}
# gif2avif <GIF>
# convert gif to avif image
function gif2avif() {
ffmpeg -i "$1" -pix_fmt yuv444p10 -strict -1 "${1%.*}.y4m";
avifenc "${1%.*}.y4m" "${1%.*}.avif";
rm -v "${1%.*}.y4m";
}
ffmpeg -i "$1" -pix_fmt yuv444p10 -strict -1 "${1%.*}.y4m";
avifenc "${1%.*}.y4m" "${1%.*}.avif";
rm -v "${1%.*}.y4m";
}

View file

@ -6,6 +6,12 @@ function skip() {
tail -n +"$((n+1))" "$@"
}
# get <i>
# get specified line number
function get() {
sed -n "$1p"
}
# usage: data_url <file>
# turn file into a data url
data_url() {

View file

@ -1,6 +0,0 @@
# webhook_post <URL>
# send curl post request
function webhook_post() {
curl -X POST "$1"
}

3
zshrc
View file

@ -49,3 +49,6 @@ do
done
alias zshrefresh="source ~/.zshrc"
# Starship
eval "$(starship init zsh)"