Added useful bash scripts

This commit is contained in:
Vishal
2022-09-03 04:00:17 +05:30
parent 28f2dc3ffb
commit 7457c78605
3 changed files with 43 additions and 0 deletions

15
scripts/configfile.cfg Normal file
View File

@@ -0,0 +1,15 @@
#nostr_servers=( "wss://relay.nostr.info" "wss://nostr-relay.wlvs.space" "wss://nostr-pub.wellorder.net" "wss://relay.damus.io" "wss://nostr.delo.software" "wss://nostr-pub.semisol.dev" "wss://nostr-relay-dev.wlvs.space")
nostr_servers=(
"wss://relay.nostr.info"
"wss://nostr.ono.re"
"wss://nostr-relay.wlvs.space"
"wss://relay.damus.io"
"wss://nostr-relay-dev.wlvs.space"
)
# reference
# https://nostr-registry.netlify.app/
# nostr.info

11
scripts/send_request.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
source ./configfile.cfg
for server in ${nostr_servers[@]};
do
>&2 echo -e "\n\n------------Sending $1 to $server---------------------------\n"
>&2 echo "echo $1 | websocat $server " ;
echo "$1" | websocat -B 300000 $server
done

17
scripts/test_servers.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
source ./configfile.cfg
limit=200
numHours=6
echo -e "Requesting all evetns in last $numHours hours with a limit of $limit"
for server in ${nostr_servers[@]};
do
echo -e "\n\n------------Testing $server---------------------------\n"
sinceSeconds=`date -d "-$numHours hour" +%s` ;
req="[\"REQ\",\"l\",{\"since\":$sinceSeconds,\"limit\":$limit}]";
echo "echo $req | websocat $server | wc " ;
echo "$req" | websocat -B 300000 $server | wc
done