feat: speedtest functions
This commit is contained in:
parent
7da6ca52d0
commit
1ca2a04784
3 changed files with 31 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
log() {
|
||||
local timestamp=$(date +"%T")
|
||||
local message="======> $1 : $timestamp"
|
||||
|
||||
echo -e "\n$message\n"
|
||||
}
|
||||
|
||||
params_required() {
|
||||
local param_name="$1"
|
||||
local error_message="$2"
|
||||
|
@ -30,3 +37,10 @@ validate_params() {
|
|||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_command() {
|
||||
if ! command -v $1 &>/dev/null; then
|
||||
log "Command $1 is not installed. Please install $1 to continue."
|
||||
exit 1
|
||||
fi
|
||||
}
|
15
configs/shell/zsh/.zsh/functions/helpers/speedtest.zsh
Normal file
15
configs/shell/zsh/.zsh/functions/helpers/speedtest.zsh
Normal file
|
@ -0,0 +1,15 @@
|
|||
SPEEDTEST_DOWNLOAD_URL="http://37.32.15.80/assets/12mb.png?_=1711896914991"
|
||||
|
||||
wget_speed() {
|
||||
check_command wget
|
||||
|
||||
log "Wget Speedtest"
|
||||
|
||||
wget -q --show-progress --progress=bar -O /dev/null $SPEEDTEST_DOWNLOAD_URL
|
||||
}
|
||||
|
||||
curl_speed() {
|
||||
check_command curl
|
||||
|
||||
curl $SPEEDTEST_DOWNLOAD_URL >/dev/null
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
source ~/.zsh/functions/helpers/validate.zsh
|
||||
source ~/.zsh/functions/helpers/main.zsh
|
||||
source ~/.zsh/functions/helpers/speedtest.zsh
|
||||
|
||||
convert_video_to_gif() {
|
||||
local fps=60
|
||||
|
|
Loading…
Add table
Reference in a new issue