diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bd59cb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +zsh/local.zsh \ No newline at end of file diff --git a/zsh/ffmpeg.zsh b/zsh/ffmpeg.zsh deleted file mode 100644 index 5d0d912..0000000 --- a/zsh/ffmpeg.zsh +++ /dev/null @@ -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" \ No newline at end of file diff --git a/zsh/fn.zsh b/zsh/fn.zsh index c6ae8f4..be66101 100644 --- a/zsh/fn.zsh +++ b/zsh/fn.zsh @@ -1,8 +1,17 @@ +alias zshconfig="micro ~/.zshrc" +alias zshrefresh="source ~/.zshrc" + # rename # 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" \ No newline at end of file +alias gfold="gfold -d classic" + +function hs() { + $(cat ~/.zsh_history|sk) +} + +alias notes="codium ~/Notes" diff --git a/zsh/media.zsh b/zsh/media.zsh index 2c637ed..6255876 100644 --- a/zsh/media.zsh +++ b/zsh/media.zsh @@ -1,18 +1,30 @@ # convert # 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 # 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"; -} \ No newline at end of file + ffmpeg -i "$1" -pix_fmt yuv444p10 -strict -1 "${1%.*}.y4m"; + avifenc "${1%.*}.y4m" "${1%.*}.avif"; + rm -v "${1%.*}.y4m"; +} diff --git a/zsh/std.zsh b/zsh/std.zsh index aa968bf..b7ce90a 100644 --- a/zsh/std.zsh +++ b/zsh/std.zsh @@ -6,6 +6,12 @@ function skip() { tail -n +"$((n+1))" "$@" } +# get +# get specified line number +function get() { + sed -n "$1p" +} + # usage: data_url # turn file into a data url data_url() { diff --git a/zsh/web.zsh b/zsh/web.zsh deleted file mode 100644 index dbbf7e0..0000000 --- a/zsh/web.zsh +++ /dev/null @@ -1,6 +0,0 @@ - -# webhook_post -# send curl post request -function webhook_post() { - curl -X POST "$1" -} \ No newline at end of file diff --git a/zshrc b/zshrc index 8bf4623..c63a51b 100644 --- a/zshrc +++ b/zshrc @@ -49,3 +49,6 @@ do done alias zshrefresh="source ~/.zshrc" + +# Starship +eval "$(starship init zsh)"