diff --git a/scripts/cut-video b/scripts/cut-video new file mode 100755 index 0000000..f55f0c3 --- /dev/null +++ b/scripts/cut-video @@ -0,0 +1,23 @@ +#!/bin/sh + +ts2sec() { + IFS=:; set -- $1 + echo $(($1*60*60 + $2*60 + $3)) +} + +SRC="$1" +START="$2" +STOP="$3" + +# Calculate the segment time (in seconds) +SPAN="$(($(ts2sec "$STOP") - $(ts2sec "$START")))" + +# Generate an output filename +OUT="$(basename "$SRC" .mkv)-cut.mkv" + +# Cut exactly the segment requested into $OUT. +ffmpeg -i "$SRC" -ss "$START" -t "$SPAN" -c copy \ + -c:v libx265 -preset slow -crf 23 \ + -c:a libopus -b:a 96k -ac 2 -ar 48000 -y -- "$OUT" + +ls -lh "$SRC" "$OUT" diff --git a/scripts/haddock-upload b/scripts/haddock-upload deleted file mode 100755 index 45db563..0000000 --- a/scripts/haddock-upload +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env nix-script -#!>zsh -#! shell | zsh curl haskellPackages.cabal-install - -# functions -conf(){ cat *.cabal | grep -Po "^$1:\s+\K.+" } -input(){ read "reply?$1 "; echo ${reply:-$2} } -inputpw(){ echo -n "$1 " >&2; scat --silent --nocode -n 24 -S $2; echo >&2 } - -# parameters -package=$(conf name) -version=$(conf version) -author=$(conf author) - -# authentication -user=$(input "user ($author):" $author) -password=$(inputpw "password:" hackage) - -cabal configure && -cabal build && -cabal haddock \ - --hyperlink-source \ - --html-location='/package/$pkg-$version/docs' \ - --contents-location='/package/$pkg' - -S=$? -if [ "$S" = "0" ]; then - cd dist/doc/html - ddir="$package-$version-docs" - cp -rf $package $ddir && - tar -cz --format=ustar -f "$ddir.tar.gz" $ddir - CS=$? - if [ "$CS" -eq "0" ]; then - echo "Uploading to Hackage..." - curl \ - -X PUT \ - -H 'Content-Type: application/x-tar' \ - -H 'Content-Encoding: gzip' \ - -u "$user:$password" \ - --data-binary "@$ddir.tar.gz" \ - "https://hackage.haskell.org/package/$package-$version/docs" - exit $? - else - echo "Error when packaging the documentation." - exit $CS - fi -else - echo "Error when trying to build the package." - exit $S -fi \ No newline at end of file diff --git a/scripts/rec b/scripts/rec new file mode 100755 index 0000000..cfada7b --- /dev/null +++ b/scripts/rec @@ -0,0 +1,18 @@ +#!/bin/sh + +record() { + sleep 2 + ffmpeg -f x11grab -r 30 -s 1920x1080 -i :0.0 -f alsa -i recorder \ + -c:v libx264 -preset ultrafast \ + -c:a libopus -b:a 96k -ac 2 -ar 48000 \ + -y recording.mkv & +} + +if test "$1" = start; then + fish -ic 'set -U AUDIO record' + record & + disown +else + fish -ic 'set -U AUDIO' + pkill ffmpeg +fi diff --git a/scripts/wa b/scripts/wa index 80bef67..06640ea 100755 --- a/scripts/wa +++ b/scripts/wa @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/sh ## WolframAlpha CLI