Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bind.dnsutils -p traceroute -p curl
# impure: needs ping
function _e {
echo "> $@"
eval "$@" 2>&1 | sed -e "s/^/ /"
printf "Exit: %s\n\n\n" "$?"
function curl_test {
curl -w "
time_namelookup: %{time_namelookup}
time_connect: %{time_connect}
time_appconnect: %{time_appconnect}
time_pretransfer: %{time_pretransfer}
time_redirect: %{time_redirect}
time_starttransfer: %{time_starttransfer}
time_total: %{time_total}
" -v -o /dev/null "$@"
function ix {
url=$(cat | curl -F 'f:1=<-' 2> /dev/null)
echo "Pasted at: $url"
_e ping -c1
_e ping -4 -c1
_e ping -6 -c1
_e dig -t A
_e dig -t A
_e traceroute -4
_e traceroute -6
_e curl_test -4 ''
_e curl_test -6 ''
_e curl -I -4 ''
_e curl -I -4 ''
_e curl -I -4 ''
_e curl -I -6 ''
_e curl -I -6 ''
_e curl -I -6 ''
) | tee /dev/stderr | ix
Copy link

vcunat commented Jul 28, 2018

Thanks Graham.

Copy link

vcunat commented May 12, 2019

Now the scripts might need updating, at least the lines with most likely won't be useful anymore, though I don't really know what data is useful here.

Copy link

zimbatm commented Sep 3, 2021

There is a new version of this script that now lives over here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment