From 1d53804dfb1301a1e8b1ea3d116140cea45518f8 Mon Sep 17 00:00:00 2001 From: Lucas Rodriguez Date: Sun, 29 Sep 2024 17:59:45 -0500 Subject: [PATCH] Add rate limit script Signed-off-by: Lucas Rodriguez --- scripts/rate_limit.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 scripts/rate_limit.sh diff --git a/scripts/rate_limit.sh b/scripts/rate_limit.sh new file mode 100755 index 0000000..c804a43 --- /dev/null +++ b/scripts/rate_limit.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -euo pipefail + +temp_file=$(mktemp) + +# Send 20 concurrent GET requests and store status codes +for _ in {1..20}; do + curl -s -o /dev/null -w "%{http_code}\n" https://osscontribute.com/repos >> "$temp_file" & +done +wait + +echo "Summary of HTTP Status Codes:" +sort "$temp_file" | uniq -c | awk '{print "Status Code " $2 ": " $1}' + +rm "$temp_file"