Skip to content

Instantly share code, notes, and snippets.

@jesopo
Last active November 14, 2019 16:40
Show Gist options
  • Save jesopo/3a4c3c87324cac1d2f33c9f471935150 to your computer and use it in GitHub Desktop.
Save jesopo/3a4c3c87324cac1d2f33c9f471935150 to your computer and use it in GitHub Desktop.
Bash script for requesting and pretty-printing ActivityPub URLs. Requires https://stedolan.github.io/jq/
#!/bin/bash
CONTENT_FILE=`mktemp`
# write headers directly to stdout ("-D-")
# write content to temp file to later pass through |jq ("-o $CONTENT_FILE")
curl -D- -s -H "Accept: application/activity+json" "$1" -o $CONTENT_FILE
cat $CONTENT_FILE | jq
rm $CONTENT_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment