aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rwxr-xr-xlocal/bin/junk8
-rwxr-xr-xlocal/bin/latest-recording2
-rwxr-xr-xlocal/bin/screenshot-prompt2
-rwxr-xr-xlocal/bin/video-to-h26421
-rwxr-xr-xlocal/bin/video-to-x26415
-rwxr-xr-xtest4
7 files changed, 36 insertions, 22 deletions
diff --git a/README.md b/README.md
index 3037653..60f4305 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# dotfiles [![Build Status](https://api.travis-ci.com/cacharle/dotfiles.svg?branch=master)](https://app.travis-ci.com/github/cacharle/dotfiles)
+# dotfiles
## Installation
@@ -29,3 +29,7 @@ $ ./install
## Credit
* mpv script youtube quality - <https://github.com/jgreco/mpv-youtube-quality>
+
+## TODO
+
+- [ ] atuin - <https://github.com/atuinsh/atuin?tab=readme-ov-file>
diff --git a/local/bin/junk b/local/bin/junk
index faf9b32..9758f68 100755
--- a/local/bin/junk
+++ b/local/bin/junk
@@ -11,9 +11,11 @@ do
if [ -e "$dest" ]
then
echo "$dest already exists, generating a prefix"
- identifier="$(seq 100 | xargs -I N sh -c "echo N; test -e '$dest__N' || exit 255" 2> /dev/null | tail -n1)"
+ identifier="$(seq 100 | xargs -I N sh -c "echo N; test -e '""$dest""__N' || exit 255" 2> /dev/null | tail -n1)"
dest="$dest"__"$identifier"
fi
- mv "$arg" "$dest" &&
- echo "$arg moved to $dest" || true
+ if mv "$arg" "$dest"
+ then
+ echo "$arg moved to $dest"
+ fi
done
diff --git a/local/bin/latest-recording b/local/bin/latest-recording
index bf3b3b2..518ffd6 100755
--- a/local/bin/latest-recording
+++ b/local/bin/latest-recording
@@ -3,5 +3,5 @@
set -e
recordings_dir="$HOME/recordings"
-latest_recording="$(ls "$recordings_dir" | sort --numeric-sort | tail -n1)"
+latest_recording="$(find "$recordings_dir"/* -prune -print | sort --numeric-sort | tail -n1)"
echo "$recordings_dir/$latest_recording"
diff --git a/local/bin/screenshot-prompt b/local/bin/screenshot-prompt
index 6852eba..b320178 100755
--- a/local/bin/screenshot-prompt
+++ b/local/bin/screenshot-prompt
@@ -23,6 +23,7 @@ screenshot_dir="$HOME/screenshots"
[ ! -d "$screenshot_dir" ] && mkdir "$screenshot_dir"
scrot_wrapper() {
+ # shellcheck disable=SC2016
file_format="$screenshot_dir/"'%Y-%m-%d_$wx$h.png'
if [ "$1" = '-' ]
then
@@ -30,6 +31,7 @@ scrot_wrapper() {
shift
else
# optipng optimizes png size without loss (doesn't work if we output directly to stdout)
+ # shellcheck disable=SC2016
command -v optipng && optipng_arg='optipng -o4 $f'
fi
scrot --silent --quality 95 --compression 9 --file "$file_format" -e "$optipng_arg" "$@"
diff --git a/local/bin/video-to-h264 b/local/bin/video-to-h264
new file mode 100755
index 0000000..8b4d21b
--- /dev/null
+++ b/local/bin/video-to-h264
@@ -0,0 +1,21 @@
+#!/usr/bin/bash
+
+file_path="$1"
+
+# from: https://stackoverflow.com/questions/2869281/how-to-determine-video-codec-of-a-file-with-ffmpeg
+current_codec="$(
+ ffprobe -v error -select_streams v:0 \
+ -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 \
+ "$file_path"
+)"
+[ "$current_codec" = 'h264' ] && { echo 'Video is already in h264'; exit 1; }
+
+# CUDA options: -hwaccel cuda -hwaccel_output_format cuda -c:v h264_nvenc
+# seems slower on gpu tho
+# There is also -c:v hvec_nvenc
+#
+# Options to reduce size: -b:v 5M -crf 28
+
+ffmpeg -i "$file_path" \
+ -map 0 -c:v libx264 -crf 18 -vf format=yuv420p -c:a copy \
+ "${file_path%%.*}-h264.${file_path##*.}"
diff --git a/local/bin/video-to-x264 b/local/bin/video-to-x264
deleted file mode 100755
index dd93ca5..0000000
--- a/local/bin/video-to-x264
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/bash
-
-file_path="$1"
-extension=
-
-
-# CUDA options: -hwaccel cuda -hwaccel_output_format cuda -c:v h264_nvenc
-# seems slower on gpu tho
-# There is also -c:v hvec_nvenc
-#
-# Options to reduce size: -b:v 5M -crf 28
-
-ffmpeg -i "$file_path" \
- -map 0 -c:v libx264 -crf 18 -vf format=yuv420p -c:a copy \
- "${file_path%%.*}-x264.${file_path##*.}"
diff --git a/test b/test
index b2970e5..49b3856 100755
--- a/test
+++ b/test
@@ -16,8 +16,8 @@ shellcheck -s sh config/x11/xinitrc
# vint -s config/vim/pluggins.vim
# FLAKE8
-flake8 --ignore F821,E501,W504,N816,E241 config/qutebrowser/config.py
-flake8 --ignore W504,CCR001 config/python/startup.py
+# flake8 --ignore F821,E501,W504,N816,E241 config/qutebrowser/config.py
+# flake8 --ignore W504,CCR001 config/python/startup.py
# CRONTAB
if crontab -h 2>&1 | grep -q '.*-T.*'