Skip to content

Instantly share code, notes, and snippets.

@riskiwah
Last active February 16, 2020 03:25
Show Gist options
  • Save riskiwah/28ef44f4c327275e1dbf00b5cba9d25d to your computer and use it in GitHub Desktop.
Save riskiwah/28ef44f4c327275e1dbf00b5cba9d25d to your computer and use it in GitHub Desktop.
#!/bin/bash
for ((i=0;i<=4;i++));do
echo "`curl --write-out '%{time_total}' --silent --output /dev/null http://example.com`" | tee -a some.txt
sleep 2
done
awk '{ total += $1; count++ } END { print total/count }' some.txt
#! /usr/bin/env python3
import requests,sys,subprocess
url = 'https://example.com'
i = 0
sys.stdout = open('asd.txt', 'w')
while (i < 5):
req = requests.get(url)
time_total = str(round(req.elapsed.total_seconds(),3))
print(time_total)
i = i + 1
if i == 5:
break
rata2 = subprocess.Popen("awk '{ total += $1; count++ } END { print total/count }' asd.txt", shell=True)
#/bin/sh
for i in 1 2 3 4 5
do
echo "`curl --write-out '%{time_total}' --silent --output /dev/null http://example.com`" | tee -a some.txt
sleep 2
done
awk '{ total += $1; count++ } END { print total/count }' some.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment