1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-11-16 11:52:47 +00:00

bin: croptop

This commit is contained in:
Phantop 2023-10-06 16:19:49 -04:00
parent 72677e6cf9
commit 85e0d80e74
3 changed files with 29 additions and 2 deletions

27
bin/croptop Executable file
View file

@ -0,0 +1,27 @@
#!/usr/bin/env sh
set -e # exit on failure
IFS=$(printf '\n\t') # smarter ifs
jxl=0
if file "$1" | grep 'JPEG XL'; then
jxl="$1"
out=$(mktemp --suffix=.jpg)
djxl "$1" "$out"
shift
set -- "$out" "$@"
fi
test "$RATIOW" || RATIOW=16
test "$RATIOH" || RATIOH=9
imagew=$(identify -format %w "$1")
des_ratio=$(printf '3 k %u %u / p' "$RATIOW" "$RATIOH" | dc)
des_height=$(printf '1 k %u %f / p' "$imagew" "$des_ratio" | dc | cut -d. -f1)
outfile="$(dirname "$1")/tran_$(basename "$1")"
jpegtran -crop "$imagew"x"$des_height" -outfile "$outfile" "$1"
if [ "$jxl" != 0 ]; then
cjxl -e 8 "$outfile" "tran_$jxl"
rm "$outfile" "$1"
fi

View file

@ -1,5 +1,5 @@
function ytflux
set cat 3
eval curl (cat ~/.miniflux)/entries?status=unread\&category_id=$cat | jq .entries[].url | xargs yt-dlp
eval curl (cat ~/.miniflux)/entries?status=unread\&category_id=$cat | jq .entries[].url | xargs yt-dlp &
eval curl -X PUT (cat ~/.miniflux)/categories/$cat/mark-all-as-read
end

View file

@ -15,7 +15,7 @@ c.url.searchengines['s'] = 'farside.link/searxng/search?q={}'
c.url.searchengines['x'] = 'aldeid.com/wiki/X86-assembly/Instructions/{}'
c.url.searchengines['y'] = 'farside.link/invidious/search?q={}'
c.url.searchengines['z'] = 'zeldawiki.wiki/wiki/{}'
c.url.searchengines['DEFAULT'] = c.url.searchengines['4']
c.url.searchengines['DEFAULT'] = c.url.searchengines['s']
c.url.start_pages = c.url.default_page = 'minifocs.fly.dev'
config.source('adblock.py')