better, faster, stronger

This commit is contained in:
qo-op 2021-06-04 05:59:48 +02:00
parent 572fdd0ece
commit 3f64b65f3f
1 changed files with 8 additions and 3 deletions

View File

@ -21,6 +21,7 @@ fi
# Force Strict #swarm0 !!?
rm -f /tmp/ipfstryme.*
rm -f ~/.zen/A_Qm_swarm.txt
liking_me_count=0
friend_of_mine_count=0
echo $(date)
@ -41,15 +42,19 @@ do
## Get "/tmp/ipfstryme.$liking_me" from Gchange "ipfstryme" message
~/.zen/astrXbian/zen/jaklis/jaklis.py -k ~/.zen/secret.dunikey -n "https://data.gchange.fr" read -n300 -j | jq -r --arg friendKEY "$liking_me" '.[] | select(.pubkey == $friendKEY)' | jq 'select(.title == "ipfstryme")' | jq -r '.content' > /tmp/ipfstryme.$liking_me
## ZOMBIE NODE sends more that 300 ipfstryme ?
## [[ $(cat /tmp/ipfstryme.$liking_me | sort | uniq | wc -l) -gt 300 ]] && echo "THIS NODE IS A ZOMBIE..." && rm -f /tmp/ipfstryme.$liking_me && continue
# CLEAN /tmp/ipfstryme.$liking_me
> /tmp/ipfstryme.clean
for line in $(cat /tmp/ipfstryme.$liking_me);
do
[[ $line == "" ]] && break
echo $line >> /tmp/ipfstryme.clean
ipfsnodeid=$(echo $line | rev | cut -d '/' -f 1 | rev)
[[ ! $(cat /tmp/ipfstryme.clean | grep $ipfsnodeid) ]] && echo $line >> /tmp/ipfstryme.clean
done
cat /tmp/ipfstryme.clean | sort | uniq > /tmp/ipfstryme.$liking_me
## ZOMBIE NODE sends more that 300 ipfstryme ?
[[ $(cat /tmp/ipfstryme.$liking_me | sort | uniq | wc -l) -gt 300 ]] && echo "THIS NODE IS A ZOMBIE..." && rm -f /tmp/ipfstryme.$liking_me && continue
cat /tmp/ipfstryme.$liking_me
echo "__________________________________________"
done