Last active
April 13, 2023 04:51
-
-
Save kphrx/235aed622130055d67680956185633c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -s plc.jsonl ]; then | |
LATEST=$(tail -n1 plc.jsonl | jq -r '.createdAt') | |
echo "From: $LATEST; $(jq -s 'unique_by(.did) | length' plc.jsonl)" | |
curl -s https://plc.directory/export\?after\=$LATEST >> plc.jsonl | |
else | |
curl -s https://plc.directory/export >> plc.jsonl | |
fi | |
echo '' >> plc.jsonl | |
jq -Mcs 'sort_by(.createdAt, .did)' plc.jsonl | jq -Mc '.[]' > plc.jsonl.tmp | |
uniq plc.jsonl.tmp > plc.jsonl | |
rm -f plc.jsonl.tmp | |
echo "To: $(tail -n1 plc.jsonl | jq -r '.createdAt'); $(jq -s 'unique_by(.did) | length' plc.jsonl)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment