Compare commits
4 Commits
e2a3cf8aac
...
b9635a5697
| Author | SHA1 | Date | |
|---|---|---|---|
|
b9635a5697
|
|||
|
153776c54e
|
|||
|
f4c500d6cd
|
|||
|
2a177b5413
|
@@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"output": {
|
"output": {
|
||||||
|
"bass_loudness#0": {
|
||||||
|
"bypass": false,
|
||||||
|
"input-gain": 0.0,
|
||||||
|
"link": -9.1,
|
||||||
|
"loudness": -3.0000000000000013,
|
||||||
|
"output": -6.0,
|
||||||
|
"output-gain": 0.0
|
||||||
|
},
|
||||||
"blocklist": [],
|
"blocklist": [],
|
||||||
"equalizer#0": {
|
"equalizer#0": {
|
||||||
"balance": 0.0,
|
"balance": 0.0,
|
||||||
@@ -259,7 +267,8 @@
|
|||||||
"split-channels": false
|
"split-channels": false
|
||||||
},
|
},
|
||||||
"plugins_order": [
|
"plugins_order": [
|
||||||
"equalizer#0"
|
"equalizer#0",
|
||||||
|
"bass_loudness#0"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
"scope": 30.0
|
"scope": 30.0
|
||||||
},
|
},
|
||||||
"bass_loudness#0": {
|
"bass_loudness#0": {
|
||||||
"bypass": true,
|
"bypass": false,
|
||||||
"input-gain": 0.0,
|
"input-gain": 0.0,
|
||||||
"link": -9.1,
|
"link": -9.1,
|
||||||
"loudness": -3.0,
|
"loudness": -3.499999999999999,
|
||||||
"output": -6.0,
|
"output": -6.0,
|
||||||
"output-gain": 0.0
|
"output-gain": 0.0
|
||||||
},
|
},
|
||||||
@@ -277,21 +277,10 @@
|
|||||||
},
|
},
|
||||||
"split-channels": false
|
"split-channels": false
|
||||||
},
|
},
|
||||||
"loudness#0": {
|
|
||||||
"bypass": false,
|
|
||||||
"clipping": false,
|
|
||||||
"clipping-range": 6.0,
|
|
||||||
"fft": "4096",
|
|
||||||
"input-gain": 8.0,
|
|
||||||
"output-gain": 0.0,
|
|
||||||
"std": "ISO226-2003",
|
|
||||||
"volume": 0.0
|
|
||||||
},
|
|
||||||
"plugins_order": [
|
"plugins_order": [
|
||||||
"equalizer#0",
|
"equalizer#0",
|
||||||
"bass_enhancer#0",
|
"bass_enhancer#0",
|
||||||
"bass_loudness#0",
|
"bass_loudness#0"
|
||||||
"loudness#0"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
watch -tn 1 date '+%l:%M:%S%p'
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Display current time and unix timestamp (updates every second).
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
watch -tn 1 date '+%H:%M:%S%n%s'
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] [file]
|
||||||
|
|
||||||
|
Copy content to system clipboard.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
file File to copy (reads from stdin if not specified)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if hash pbcopy 2>/dev/null; then
|
if hash pbcopy 2>/dev/null; then
|
||||||
exec pbcopy
|
exec pbcopy
|
||||||
elif hash xclip 2>/dev/null; then
|
elif hash xclip 2>/dev/null; then
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <url>
|
||||||
|
|
||||||
|
Display detailed curl statistics for a URL.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
url URL to fetch statistics for
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
curl -sLw @- -o /dev/null "$@" <<'EOF'
|
curl -sLw @- -o /dev/null "$@" <<'EOF'
|
||||||
URL:\t\t\t%{url}\n
|
URL:\t\t\t%{url}\n
|
||||||
Address:\t\t%{remote_ip}:%{remote_port}\n
|
Address:\t\t%{remote_ip}:%{remote_port}\n
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
CONTAINER="my-container" # the name of the container in which to 'exec' something
|
|
||||||
CONFIG="$(dirname $([ -L $0 ] && readlink -f $0 || echo $0))/docker-compose.yml" # path to compose yml file
|
|
||||||
CMD="docker-compose -f $CONFIG" # docker-compose command
|
|
||||||
APP_URL='http://localhost:8000/'
|
|
||||||
|
|
||||||
open_browser() {
|
|
||||||
if which xdg-open > /dev/null; then
|
|
||||||
xdg-open "$1" </dev/null >/dev/null 2>&1 & disown
|
|
||||||
elif which gnome-open > /dev/null; then
|
|
||||||
gnome-open "$1" </dev/null >/dev/null 2>&1 & disown
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
'' | 'help' ) echo -e "Provide one of operations: \t start, stop, up, down, restart, rebuild, open";
|
|
||||||
echo "Otherwise all args will be passed to 'docker exec -ti $CONTAINER ...'" ;;
|
|
||||||
'open' ) open_browser $APP_URL ;;
|
|
||||||
'up' ) $CMD up -d --build ;; # build and start containers
|
|
||||||
'down' ) $CMD down --remove-orphans ;; # stop and remove containers
|
|
||||||
'start' ) $CMD start ;; # start containers
|
|
||||||
'stop' ) $CMD stop ;; # stop containers
|
|
||||||
'restart' ) $CMD stop && $CMD start ;; # restart containers
|
|
||||||
'rebuild' ) $CMD down --remove-orphans && $CMD up -d --build ;; # rebuild containers
|
|
||||||
* ) docker exec -ti $CONTAINER $@ # exec anything in container
|
|
||||||
esac
|
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||||
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
echo "Usage: $(basename "$0") <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
|
||||||
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
|
echo " $(basename "$0") <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
|
||||||
exit 1
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " -h, --help Show this help message"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for n in "$@"; do
|
for n in "$@"; do
|
||||||
|
|||||||
@@ -1,3 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Flush DNS cache using resolvectl.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
sudo resolvectl flush-caches
|
sudo resolvectl flush-caches
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
show_usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] [search]
|
||||||
|
|
||||||
|
List or search HTTP status codes.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
search Search term to filter status codes
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
show_usage
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
statuses="100 Continue
|
statuses="100 Continue
|
||||||
101 Switching Protocols
|
101 Switching Protocols
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <command>
|
||||||
|
|
||||||
|
Check if a command is available.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
command Command to check
|
||||||
|
|
||||||
|
Returns 0 if command exists, 1 otherwise.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
[ -n "$1" ] && command -v "$1" || exit 1
|
[ -n "$1" ] && command -v "$1" || exit 1
|
||||||
|
|||||||
@@ -1,4 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
echo -n "$@" | wc -c | awk '{print $1}'
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <string>
|
||||||
|
|
||||||
|
Display length of a string.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
string String to measure
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -t 0 ]]; then # Read from stdin (pipe)
|
||||||
|
wc -c | awk '{print $1}'
|
||||||
|
else # Read from arguments
|
||||||
|
echo -n "$@" | wc -c | awk '{print $1}'
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <lineno> <file>
|
||||||
|
|
||||||
|
Display a specific line from a file.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
lineno Line number to display (1-based)
|
||||||
|
file File to read from
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
lineno="$1"; shift
|
lineno="$1"; shift
|
||||||
sed -n "${lineno}p" -- "$@"
|
|
||||||
|
if [[ ! -t 0 ]]; then # Read from stdin (pipe)
|
||||||
|
sed -n "${lineno}p"
|
||||||
|
else # Read from file
|
||||||
|
sed -n "${lineno}p" -- "$@"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <directory>
|
||||||
|
|
||||||
|
Create directory and change to it.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
directory Directory to create and enter
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "$1"
|
mkdir -p "$1"
|
||||||
cd "$1" || exit
|
cd "$1" || false
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <script>
|
||||||
|
|
||||||
|
Create a new bash script with boilerplate.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
script Script filename to create
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! $# -eq 1 ]; then
|
if [ ! $# -eq 1 ]; then
|
||||||
echo 'mksh takes one argument' 1>&2
|
echo 'mksh takes one argument' 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -9,13 +25,11 @@ elif [ -e "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '#!/usr/bin/env bash
|
{
|
||||||
set -e
|
echo '#!/usr/bin/env bash'
|
||||||
set -u
|
echo 'set -eo pipefail'
|
||||||
set -o pipefail
|
echo
|
||||||
|
} > "$1"
|
||||||
' > "$1"
|
|
||||||
|
|
||||||
chmod u+x "$1"
|
chmod u+x "$1"
|
||||||
|
exec "$EDITOR" "$1"
|
||||||
nano "$1"
|
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
curl http://ipecho.net/plain
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
echo
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Display external IP address.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "-2" ]]; then
|
||||||
|
curl -fsSL https://api.myip.com | jq -r .ip
|
||||||
|
else
|
||||||
|
curl -fsSL http://ipecho.net/plain
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|||||||
171
utils/.local/bin/notes
Executable file
171
utils/.local/bin/notes
Executable file
@@ -0,0 +1,171 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#shellcheck disable=SC2155,SC2207
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
NOTES_DIR="$HOME/notes"
|
||||||
|
EDITOR="${EDITOR:-nano}"
|
||||||
|
mkdir -p "$NOTES_DIR"
|
||||||
|
|
||||||
|
show_usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") <command> [options]
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
add Create a new note
|
||||||
|
edit Open a note in editor
|
||||||
|
rm Remove a note
|
||||||
|
list List all notes
|
||||||
|
|
||||||
|
Options for 'add':
|
||||||
|
-n, --name <name> Custom note name (default: <unixtime>-untitled-note.md)
|
||||||
|
-t, --title <title> Custom note title (default: "Untitled note")
|
||||||
|
--no-time Don't add creation timestamp
|
||||||
|
--no-edit Don't open editor
|
||||||
|
|
||||||
|
Options for 'edit':
|
||||||
|
<name> Note filename to edit
|
||||||
|
|
||||||
|
Options for 'rm':
|
||||||
|
<name> Note filename to remove
|
||||||
|
|
||||||
|
Options for 'list':
|
||||||
|
(none)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_add() {
|
||||||
|
local name="untitled-note"
|
||||||
|
local title="Untitled note"
|
||||||
|
local add_time=true
|
||||||
|
local new_edit=true
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
-n|--name) name="$2"; shift 2 ;;
|
||||||
|
-t|--title) title="$2"; shift 2 ;;
|
||||||
|
--no-time) add_time=false; shift ;;
|
||||||
|
--no-edit) new_edit=false; shift ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option: $1"
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
local filename="$(date +%s)-${name}.md"
|
||||||
|
local filepath="$NOTES_DIR/$filename"
|
||||||
|
|
||||||
|
{
|
||||||
|
echo "# $title"
|
||||||
|
echo
|
||||||
|
if [[ "$add_time" == true ]]; then
|
||||||
|
echo
|
||||||
|
echo "Created at $(date '+%Y-%m-%d %H:%M:%S')"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
echo "---"
|
||||||
|
echo
|
||||||
|
} > "$filepath"
|
||||||
|
|
||||||
|
echo "Created note: $filepath"
|
||||||
|
|
||||||
|
if [[ "$new_edit" == true ]]; then
|
||||||
|
$EDITOR "$filepath"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_edit() {
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Error: Note name required"
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local filename="$1"
|
||||||
|
local filepath="$NOTES_DIR/$filename"
|
||||||
|
|
||||||
|
if [[ ! -f "$filepath" ]]; then
|
||||||
|
echo "Error: Note not found: $filename"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$EDITOR "$filepath"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_rm() {
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Error: Note name required"
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local filename="$1"
|
||||||
|
local filepath="$NOTES_DIR/$filename"
|
||||||
|
|
||||||
|
if [[ ! -f "$filepath" ]]; then
|
||||||
|
echo "Error: Note not found: $filename"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -v "$filepath"
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_list() {
|
||||||
|
local count=0
|
||||||
|
printf "%-40s %s\n" "Filename" "Title"
|
||||||
|
printf "%-40s %s\n" "--------" "-----"
|
||||||
|
|
||||||
|
# Use nullglob to handle empty directory case
|
||||||
|
local shopt_save
|
||||||
|
shopt_save=$(shopt -p nullglob)
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
local files=("$NOTES_DIR"/*.md)
|
||||||
|
|
||||||
|
# Restore original nullglob setting
|
||||||
|
eval "$shopt_save"
|
||||||
|
|
||||||
|
for file in "${files[@]}"; do
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
local filename=$(basename "$file")
|
||||||
|
local title=$(sed -n 's/^# \([^#].*\)/\1/p' "$file" | head -n1)
|
||||||
|
|
||||||
|
if [[ -z "$title" ]]; then
|
||||||
|
title="Untitled note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%-40s # %s\n" "$filename" "$title"
|
||||||
|
((count++))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $count -eq 0 ]]; then
|
||||||
|
echo "No notes found"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Total: $count note(s)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
cmd_list "$@"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
command="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
add) cmd_add "$@" ;;
|
||||||
|
edit) cmd_edit "$@" ;;
|
||||||
|
rm) cmd_rm "$@" ;;
|
||||||
|
list) cmd_list "$@" ;;
|
||||||
|
-h|--help|help) show_usage ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown command: $command"
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
62
utils/.local/bin/notes-completion
Normal file
62
utils/.local/bin/notes-completion
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#shellcheck disable=SC2155,SC2207,SC2309,SC2034,SC2154,SC1087
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
_notes_completion() {
|
||||||
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
local command="${COMP_WORDS[1]}"
|
||||||
|
|
||||||
|
if [[ COMP_CWORD -eq 1 ]]; then
|
||||||
|
COMPREPLY=($(compgen -W "add edit rm list" -- "$cur"))
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$command" == "edit" || "$command" == "rm" ]]; then
|
||||||
|
local notes_dir="$HOME/notes"
|
||||||
|
local notes=()
|
||||||
|
if [[ -d "$notes_dir" ]]; then
|
||||||
|
for file in "$notes_dir"/*.md; do
|
||||||
|
if [[ -f "$file" ]]; then
|
||||||
|
notes+=("$(basename "$file")")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=($(compgen -W "$(printf '%s\n' "${notes[@]}")" -- "$cur"))
|
||||||
|
compopt -o filenames
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_notes() {
|
||||||
|
local -a commands=(
|
||||||
|
'add:Create a new note'
|
||||||
|
'edit:Open a note in editor'
|
||||||
|
'rm:Remove a note'
|
||||||
|
'list:List all notes'
|
||||||
|
)
|
||||||
|
|
||||||
|
if (( CURRENT == 2 )); then
|
||||||
|
_describe 'command' commands
|
||||||
|
elif (( CURRENT >= 3 )); then
|
||||||
|
case $words[2] in
|
||||||
|
edit|rm)
|
||||||
|
local notes_dir="$HOME/notes"
|
||||||
|
if [[ -d "$notes_dir" ]]; then
|
||||||
|
_files -W "$notes_dir" -g '*.md'
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
_message 'no more arguments'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -n "$BASH_VERSION" ]]; then
|
||||||
|
complete -F _notes_completion notes ./notes
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
|
compdef _notes notes ./notes
|
||||||
|
fi
|
||||||
@@ -1,3 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
date '+%d.%m.%Y %H:%M:%S'
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Display current time and unix timestamp.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
date '+%H:%M:%S%n%s'
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <files...>
|
||||||
|
|
||||||
|
Change ownership of files to current user.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
files Files or directories to change ownership
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
sudo chown "$(whoami)". -R --changes --preserve-root "$@"
|
sudo chown "$(whoami)". -R --changes --preserve-root "$@"
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Paste content from system clipboard.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if hash pbpaste 2>/dev/null; then
|
if hash pbpaste 2>/dev/null; then
|
||||||
exec pbpaste
|
exec pbpaste
|
||||||
elif hash xclip 2>/dev/null; then
|
elif hash xclip 2>/dev/null; then
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Set default permissions for files and directories in current directory.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Sets:
|
||||||
|
- Files: 0664 (rw-rw-r--)
|
||||||
|
- Directories: 0775 (rwxrwxr-x)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO permissions via arguments
|
# TODO permissions via arguments
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
process_list="$(ps -eo 'pid command')"
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
if [[ $# != 0 ]]; then
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] [filter]
|
||||||
|
|
||||||
|
Display running processes.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
filter Optional filter string to match processes
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
process_list="$(ps -eo 'pid command')"
|
||||||
|
else
|
||||||
process_list="$(echo "$process_list" | grep -Fiw "$@")"
|
process_list="$(echo "$process_list" | grep -Fiw "$@")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$process_list" |
|
echo "$process_list" \
|
||||||
grep -Fv "${BASH_SOURCE[0]}" |
|
| grep -Fv "${BASH_SOURCE[0]}" \
|
||||||
grep -Fv grep |
|
| grep -Fv grep \
|
||||||
GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
|
| GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Open a temporary scratchpad file in \$EDITOR.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
file="$(mktemp)"
|
file="$(mktemp)"
|
||||||
echo "Editing $file"
|
echo "Editing $file"
|
||||||
exec "$EDITOR" "$file"
|
exec "$EDITOR" "$file"
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
port='8888'
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
if [ $# -eq 1 ]; then
|
cat <<EOF
|
||||||
port="$1"
|
Usage: $(basename "$0") [-h] [port]
|
||||||
|
|
||||||
|
Start a simple HTTP server in current directory.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
port Port number (default: 8888)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
port="${1:-8888}"
|
||||||
|
|
||||||
if hash php 2>/dev/null; then
|
if hash php 2>/dev/null; then
|
||||||
exec php -S "localhost:$port"
|
exec php -S "localhost:$port"
|
||||||
elif hash python3 2>/dev/null; then
|
elif hash python3 2>/dev/null; then
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <seconds>
|
||||||
|
|
||||||
|
Set a timer with desktop notification.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
seconds Timer duration in seconds
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
sleep "$1"
|
sleep "$1"
|
||||||
notify-send 'Timer complete!' \
|
notify-send 'Timer complete!' \
|
||||||
-u normal \
|
-u normal \
|
||||||
|
|||||||
17
utils/.local/bin/today
Executable file
17
utils/.local/bin/today
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Display current date.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
date '+%d.%m.%Y'
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <files...>
|
||||||
|
|
||||||
|
Move files to trash using gio.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
files Files or directories to move to trash
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
gio trash "$@"
|
gio trash "$@"
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/husr/bin/env bash
|
||||||
set -u
|
set -uo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <command>
|
||||||
|
|
||||||
|
Retry a command until it fails.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
command Command to repeatedly execute
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
while [[ "$?" -eq 0 ]]; do
|
while [[ "$?" -eq 0 ]]; do
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -u
|
set -uo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <command>
|
||||||
|
|
||||||
|
Retry a command until it succeeds.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
command Command to repeatedly execute
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
"$@"
|
"$@"
|
||||||
while [[ "$?" -ne 0 ]]; do
|
while [[ "$?" -ne 0 ]]; do
|
||||||
|
|||||||
16
utils/.local/bin/unixtime
Executable file
16
utils/.local/bin/unixtime
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Display current unix timestamp.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
date '%s'
|
||||||
@@ -1,10 +1,23 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h]
|
||||||
|
|
||||||
|
Upgrade system packages (apt, snap, flatpak).
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
is apt >/dev/null && {
|
is apt >/dev/null && {
|
||||||
echo
|
echo
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo "Upgarding apt packages..."
|
echo "Upgrading apt packages..."
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo
|
echo
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -14,7 +27,7 @@ is apt >/dev/null && {
|
|||||||
is snap >/dev/null && {
|
is snap >/dev/null && {
|
||||||
echo
|
echo
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo "Upgarding snap packages..."
|
echo "Upgrading snap packages..."
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo
|
echo
|
||||||
sudo snap refresh
|
sudo snap refresh
|
||||||
@@ -23,7 +36,7 @@ is snap >/dev/null && {
|
|||||||
is flatpak >/dev/null && {
|
is flatpak >/dev/null && {
|
||||||
echo
|
echo
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo "Upgarding flatpak packages..."
|
echo "Upgrading flatpak packages..."
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo
|
echo
|
||||||
sudo flatpak update -y
|
sudo flatpak update -y
|
||||||
|
|||||||
@@ -1,12 +1,38 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
curl "https://r.jina.ai/$1" \
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <url>
|
||||||
|
|
||||||
|
Convert webpage URL to markdown using jina.ai.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
url URL of webpage to convert
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# More details: https://jina.ai/reader/
|
||||||
|
|
||||||
|
url="$1"; shift
|
||||||
|
curl "https://r.jina.ai/$url" \
|
||||||
-sS \
|
-sS \
|
||||||
-H "DNT: 1" \
|
-H "DNT: 1" \
|
||||||
|
-H "X-Md-Hr: ---" \
|
||||||
-H "X-Base: final" \
|
-H "X-Base: final" \
|
||||||
-H "X-Engine: direct" \
|
-H "X-Timeout: 10" \
|
||||||
|
-H "X-Locale: ru-RU" \
|
||||||
|
-H "X-No-Cache: true" \
|
||||||
|
-H "X-Engine: browser" \
|
||||||
|
-H "X-User-Agent: url2md" \
|
||||||
-H "X-Md-Em-Delimiter: *" \
|
-H "X-Md-Em-Delimiter: *" \
|
||||||
-H "X-Md-Heading-Style: setext" \
|
-H "X-Md-Link-Style: inlined" \
|
||||||
|
-H "X-Return-Format: markdown" \
|
||||||
|
-H "X-Keep-Img-Data-Url: true" \
|
||||||
-H "X-Md-Link-Reference-Style: collapsed" \
|
-H "X-Md-Link-Reference-Style: collapsed" \
|
||||||
-H "X-Md-Link-Style: referenced"
|
"$@"
|
||||||
|
|||||||
@@ -1,4 +1,30 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <input.mp4>
|
||||||
|
|
||||||
|
Compress MP4 video using ffmpeg.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
input.mp4 Input video file (must be .mp4)
|
||||||
|
|
||||||
|
Output:
|
||||||
|
<input>_compressed.mp4
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
filename="${1%.mp4}"
|
filename="${1%.mp4}"
|
||||||
ffmpeg -i "$filename".mp4 -c:v libx264 -crf 28 -preset veryslow -c:a aac -b:a 128k "$filename"_compressed.mp4
|
ffmpeg \
|
||||||
|
-i "$filename".mp4 \
|
||||||
|
-c:v libx264 \
|
||||||
|
-crf 28 \
|
||||||
|
-preset veryslow \
|
||||||
|
-c:a aac \
|
||||||
|
-b:a 128k \
|
||||||
|
"$filename"_compressed.mp4
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <pid>
|
||||||
|
|
||||||
|
Wait for a process to complete.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
pid Process ID to wait for
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
if hash systemd-inhibit 2>/dev/null; then
|
if hash systemd-inhibit 2>/dev/null; then
|
||||||
systemd-inhibit \
|
systemd-inhibit \
|
||||||
--who=waitfor \
|
--who=waitfor \
|
||||||
|
|||||||
@@ -1,4 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
#set -eo pipefail
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <command>
|
||||||
|
|
||||||
|
Show detailed information about a command.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
command Command to investigate
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
type "$1" 2>/dev/null
|
type "$1" 2>/dev/null
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
# Download music from Youtube or Youtube Music
|
# Download music from Youtube or Youtube Music
|
||||||
# and save as top quality flac file without video
|
# and save as top quality flac file without video
|
||||||
@@ -6,6 +7,25 @@
|
|||||||
# Usage: $ ytmusic https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
# Usage: $ ytmusic https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||||
# More info: https://github.com/ytdl-org/youtube-dl
|
# More info: https://github.com/ytdl-org/youtube-dl
|
||||||
|
|
||||||
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $(basename "$0") [-h] <url>
|
||||||
|
|
||||||
|
Download music from YouTube or YouTube Music as FLAC.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-h, --help Show this help message
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
url YouTube or YouTube Music URL (playlist or video)
|
||||||
|
|
||||||
|
Output:
|
||||||
|
$HOME/ytmusic/<playlist>/<channel> - <title>.flac
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
DEST_PATH="${HOME}/ytmusic"
|
DEST_PATH="${HOME}/ytmusic"
|
||||||
mkdir -p "${DEST_PATH}"
|
mkdir -p "${DEST_PATH}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user