mirror of
https://github.com/mr0xb/scripts.git
synced 2026-08-27 19:34:57 -04:00
initial commit
This commit is contained in:
parent
2f723ac7ee
commit
62156a1d85
9 changed files with 68 additions and 0 deletions
4
media/yt-audio
Executable file
4
media/yt-audio
Executable file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
exec youtube-dl \
|
||||||
|
--ignore-errors --output "%(title)s.%(ext)s" \
|
||||||
|
--extract-audio --audio-format mp3 "$@"
|
||||||
3
media/yt-transcribe
Executable file
3
media/yt-transcribe
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
cd ~/Downloads || exit
|
||||||
|
yt-dlp --write-auto-sub --sub-lang en --skip-download "$1" -o "yt-transcription.%(ext)s"
|
||||||
10
util/confirm
Executable file
10
util/confirm
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
confirm () {
|
||||||
|
declare yn
|
||||||
|
read -p " [y/N] " yn
|
||||||
|
[[ ${yn,,} =~ y(es)? ]] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
confirm
|
||||||
3
util/datepath
Normal file
3
util/datepath
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
date +%4Y_%m_%d "-d $@"
|
||||||
8
util/dockerclean
Normal file
8
util/dockerclean
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
all=$(sudo docker ps -aq)
|
||||||
|
if [[ -z $all ]];then
|
||||||
|
echo "No containers found."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
sudo docker rm $all
|
||||||
5
util/dquote
Normal file
5
util/dquote
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
while read -r line; do
|
||||||
|
echo "\"$line\","
|
||||||
|
done
|
||||||
3
util/myip
Normal file
3
util/myip
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dig +short myip.opendns.com @resolver1.opendns.com
|
||||||
22
util/pyhttp
Executable file
22
util/pyhttp
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if command -v python3 &> /dev/null; then
|
||||||
|
PYTHON_CMD="python3"
|
||||||
|
elif command -v python &> /dev/null; then
|
||||||
|
PYTHON_CMD="python"
|
||||||
|
elif command -v python2 &> /dev/null; then
|
||||||
|
PYTHON_CMD="python2"
|
||||||
|
else
|
||||||
|
echo "Error: No Python interpreter found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=$($PYTHON_CMD -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
|
||||||
|
|
||||||
|
if [[ "$VERSION" == 3.* ]]; then
|
||||||
|
$PYTHON_CMD -m http.server --bind $1 --directory $2
|
||||||
|
elif [[ "$VERSION" == 2.* ]]; then
|
||||||
|
$PYTHON_CMD -m SimpleHTTPServer --bind $1 --directory $2
|
||||||
|
else
|
||||||
|
echo "Unknown Python version"
|
||||||
|
fi
|
||||||
10
util/yqdiff
Executable file
10
util/yqdiff
Executable file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script reliably compares the differences between two YAML files
|
||||||
|
# even with differeing nested values (useful for Helm values files
|
||||||
|
# comparisons and more). Note that the resulting diff CANNOT be reliably
|
||||||
|
# used as a patch against the YAML file since the comments are stripped
|
||||||
|
# during the comparison.
|
||||||
|
|
||||||
|
[[ -z $(command -v yq) ]] && echo "missing yq command" && exit 1
|
||||||
|
exec diff <(yq 'sort_keys(..) | ... comments=""' -P "$1") <(yq 'sort_keys(..) | ... comments=""' -P "$2")
|
||||||
Loading…
Reference in a new issue