diff options
-rwxr-xr-x | .local/bin/caption-generator | 52 | ||||
-rwxr-xr-x | .local/bin/mansplain | 2 | ||||
-rwxr-xr-x | .local/bin/random | 4 | ||||
-rwxr-xr-x | .local/bin/random-alnum | 4 | ||||
-rwxr-xr-x | .local/bin/screenshot | 6 | ||||
-rwxr-xr-x | .local/bin/timefinder | 10 |
6 files changed, 78 insertions, 0 deletions
diff --git a/.local/bin/caption-generator b/.local/bin/caption-generator new file mode 100755 index 0000000..ad7bd83 --- /dev/null +++ b/.local/bin/caption-generator @@ -0,0 +1,52 @@ +#!/bin/bash + +if [ -z ${1+x} ] || [ -z ${2+x} ] || [ -z ${3+x} ] ; then +echo "Usage: $0 url caption output_file (caption_height)"; +exit 1 +fi; + +if [ -z ${4+x} ]; then +CAPTION_HEIGHT=50; +else +CAPTION_HEIGHT=$4; +fi + +echo "gif caption adder by turret" +#echo "THIS WILL DIRTY THE DIRECTORY!" +echo "@url: $1 +@caption: $2 +@output: $3 +@caption_height: $CAPTION_HEIGHT" +echo "enter to confirm/ack" +read + +set -x + +curl -L "$1" > input.gif +ffmpeg -y -i input.gif input.mp4 +blind-from-video input.mp4 input.bl + +FPS=$(calc round\($(ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate input.mp4)\)) +FRAMES=$(ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 input.mp4) +WIDTH=$(ffprobe -v error -select_streams v -show_entries stream=width -of csv=p=0:s=x input.mp4) +HEIGHT=$(ffprobe -v error -select_streams v -show_entries stream=height -of csv=p=0:s=x input.mp4) +TOTAL_HEIGHT=$(calc round\($CAPTION_HEIGHT+$HEIGHT\)) + +convert -size "$WIDTH x $CAPTION_HEIGHT" -fill black -font "Impact" -gravity center caption:"$2" caption.png + +cat input.bl | \ +blind-extend -a $CAPTION_HEIGHT > input-fin.bl + +cat caption.png | png2ff | \ +blind-from-image | \ +blind-extend -b $HEIGHT | \ +blind-repeat $FRAMES - > caption-fin.bl + +blind-stack caption-fin.bl input-fin.bl | \ +blind-to-video $FPS -c:v libx264 -preset veryslow -crf 0 -pix_fmt yuv444p -y output.mp4 + +ffmpeg -y -i output.mp4 $3 + +rm output.mp4 caption-fin.bl input.bl input-fin.bl input.gif input.mp4 caption.png + +set +x diff --git a/.local/bin/mansplain b/.local/bin/mansplain new file mode 100755 index 0000000..619341f --- /dev/null +++ b/.local/bin/mansplain @@ -0,0 +1,2 @@ +#!/bin/bash +zathura - < <(man -Tpdf $(man -k . | sort | dmenu -l 30 | awk '{print $1.$2}')) diff --git a/.local/bin/random b/.local/bin/random new file mode 100755 index 0000000..e3875f8 --- /dev/null +++ b/.local/bin/random @@ -0,0 +1,4 @@ +#!/bin/bash +CHARACTER_SET="[:punct:][:alnum:]" +read -r -n $1 rand < <(LC_ALL=C tr -dc "${CHARACTER_SET}" < /dev/urandom) +printf "%s" "${rand}" diff --git a/.local/bin/random-alnum b/.local/bin/random-alnum new file mode 100755 index 0000000..893816d --- /dev/null +++ b/.local/bin/random-alnum @@ -0,0 +1,4 @@ +#!/bin/bash +CHARACTER_SET="[:alnum:]" +read -r -n $1 rand < <(LC_ALL=C tr -dc "${CHARACTER_SET}" < /dev/urandom) +printf "%s" "${rand}" diff --git a/.local/bin/screenshot b/.local/bin/screenshot new file mode 100755 index 0000000..085c47d --- /dev/null +++ b/.local/bin/screenshot @@ -0,0 +1,6 @@ +#!/bin/sh +FILE=~/Pictures/$(date --iso-8601=seconds).png +scrot -izfps -F - > $FILE +xclip -in -selection clipboard -target image/png < $FILE +# | xclip -in -selection clipboard -target image/png \ +# && xclip -out > $(echo -n ~/Pictures/$(date --iso-8601=seconds).png) diff --git a/.local/bin/timefinder b/.local/bin/timefinder new file mode 100755 index 0000000..2e8544f --- /dev/null +++ b/.local/bin/timefinder @@ -0,0 +1,10 @@ +#!/bin/sh +TIMEZONE=${1:-$(cat /etc/timezone)} + +[ ! -f /usr/share/zoneinfo/${TIMEZONE} ] && echo "invalid zone" && exit 1 + +LOCALE=${2:-en-US} +CHARACTER_SET="[:alnum:]" +read -r -n 10 S < <(LC_ALL=C tr -dc "${CHARACTER_SET}" < /dev/urandom) +echo -n "https://time.turret.cyou/${TIMEZONE}?locale=${LOCALE}&s=${S}" | xclip -in -selection clipboard +xclip -out -selection clipboard && echo |