1
Fork 0
dotfiles/.functions.zsh

45 lines
1.1 KiB
Bash
Raw Normal View History

2023-01-20 10:09:01 +00:00
# Copies a section from a video using ffmpeg.
# extract-clip <input file> <start timestamp> <end timestamp> <output file>
2023-01-19 08:44:09 +00:00
extract-clip () {
ffmpeg -ss "$2" -i "$1" -to "$3" -c copy "$4"
2023-01-19 08:44:09 +00:00
}
2023-01-20 10:09:01 +00:00
# Creates a new signed, annotated git tag.
# gtag <version number>
2022-07-20 12:29:08 +00:00
gtag () {
git tag -s -a "$1" -m "Version $1"
}
2022-09-05 12:34:28 +00:00
2023-01-20 10:09:01 +00:00
# Tries to find a feed URL for any given URLs.
# get-feed-url <url ...>
2022-09-05 12:34:28 +00:00
get-feed-url () {
for input_url in "$@"; do
html=$(curl -fsLS "$input_url")
echo $(echo $html | select-html '[property="og:title"]' -a "content")
echo $(echo $html | select-html '[rel="alternate"][type]' -a "href")
echo
done
}
2023-01-01 12:54:30 +00:00
2023-02-23 10:56:41 +00:00
# Create a directory and cd into it.
# mc <directory>
mc () {
mkdir -p "$1"
cd "$1"
}
2023-03-13 23:02:37 +00:00
# Select a window and resize it to the specified resolution.
# resize-window [width (default: 1280)] [height (default: 720)]
resize-window () {
xdotool selectwindow windowsize ${1-1280} ${2-720}
}
2023-01-20 10:09:01 +00:00
# Converts any given files to 128K Opus using ffmpeg.
# to-opus <file ...>
2023-01-01 12:54:30 +00:00
to-opus () {
for input_file in "$@"; do
output_file="${input_file%.*}.opus"
ffmpeg -i "$input_file" -c:a libopus -b:a 128K "$output_file"
done
}