Skip to content

Instantly share code, notes, and snippets.

@jsteenb2
Created August 17, 2020 18:10
Show Gist options
  • Save jsteenb2/183e8dd92980cbc6ba03346e604e7e3e to your computer and use it in GitHub Desktop.
Save jsteenb2/183e8dd92980cbc6ba03346e604e7e3e to your computer and use it in GitHub Desktop.
helper dotfile
alias srcz='source ~/.zshrc'
alias vimz='vim ~/.zshrc'
alias gitcop='git co master && git fap && git pull'
alias ggui='git gui'
alias poof='git poof'
whoseport () {
lsof -i ":$1" | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} LISTEN
}
ls () {
command ls -lh $2
}
shrink () {
FILE=$(basename -- "$1")
local mp4="${FILE%%.*}.mp4"
ffmpeg -i $1 ${2:-$HOME/Desktop/mp4ed/$mp4}
}
speedch () {
while (( $# )) do
case $1 in
--pts)
pts=$2
shift
;;
-i|--input)
input="$2"
shift
;;
-o|--output)
output="$2"
shift
;;
*) echo "invalid argument provided: $1"
return 1
esac
shift
done
[[ ! $input ]] && echo "no input file provided" && return 1
[[ ! $output ]] && echo "no output file provide" && return 1
[[ ! $pts ]] && echo "no point set opt provided" && return 1
ffmpeg -i $input -filter:v "setpts=${pts}*PTS" $output
}
gifit () {
while (( $# )) do
case $1 in
--fps)
fps=$2
shift
;;
--scale)
scale="$2"
shift
;;
--loop)
loop="$2"
shift
;;
-i|--input)
input="$2"
shift
;;
-o|--output)
output="$2"
shift
;;
*) echo "invalid argument provided: $1"
return 1
esac
shift
done
[[ ! $input ]] && echo "no input file provided" && return 1
[[ ! $output ]] && echo "no output file provide" && return 1
ffmpeg -i $input -vf "fps=${fps:-30},scale=${scale:-640}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop ${loop:-0} $output
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment