diff --git a/.brew b/.brew index f6ef2ed..221deca 100755 --- a/.brew +++ b/.brew @@ -19,6 +19,8 @@ echo '--> Install libraries and applications' brew cask install iterm2 brew install bash brew install ffmpeg +brew install rs/tap/jaggr +brew install rs/tap/jplot brew install tmux brew install reattach-to-user-namespace brew install vim diff --git a/.functions b/.functions index 043eaa2..d5d91d9 100644 --- a/.functions +++ b/.functions @@ -276,7 +276,7 @@ function loc() { # Uploads a file to transfer.sh and returns the public URL # Usage: transfer -transfer() { +function transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; @@ -295,3 +295,15 @@ transfer() { echo "\n"; rm -f $tmpfile; } + +# Graph ping between host and a given hostname +# Usage: ping +function pingraph { + while true; do echo '{"value": '`ping -c 1 $1 | awk -F"=| " 'NR==2 {print $10}'`'}'; sleep 0.5; done | jplot value +} + +# Graph (using curl and jplot) website response times +# Usage: wwwgraph +function wwwgraph { + while true; do curl -s -o /dev/null -w '{"lookup": %{time_namelookup}, "connect": %{time_connect}, "appconnect": %{time_appconnect}, "pretransfer": %{time_pretransfer}, "redirect": %{time_redirect}, "starttransfer": %{time_starttransfer}, "total": %{time_total}}' $1 | sed -E 's/([0-9]),([0-9])/\1.\2/g'; sleep 1.5; done | jplot lookup+connect+appconnect+pretransfer+redirect+starttransfer+total +}