Skip to content

Instantly share code, notes, and snippets.

Created April 3, 2021 20:28
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A personalized weekly Pinboard-based newsletter of pages you said you wanted to read.
set -e;
# Creates a simple email message containing links from your recent Pinboard
# bookmarks that are marked as "to read".
echo "[$(date)] Beginning pinboard weekly summary...";
TO="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
FROM=$(date --date="$FROM -7 day" +'%Y-%m-%dT%H:%M:%SZ')
TOREAD=$(curl -s $URL | jq -c -r '.[] | select(.toread | contains("yes")) | @base64');
REPORT="$(date -I).html"
getmailbody() {
echo "<h1>Weekly Pinboard Reading List</h1>";
echo "<h3>For the week of $(date -I)</h3>"
echo "<p>For your use, here's a selection of articles you said you wanted to read.</p>"
echo "<ul>"
echo "$TOREAD" | while read ROW; do
# Solution from
_jq() {
echo ${ROW} | base64 --decode | jq -r ${1}
if [ -n "$ROW" ]; then
NAME="$(_jq '.description')"
DESC="$(_jq '.extended')"
LINK="$(_jq '.href')"
DESC=${DESC:="<i>no description</i>"}
echo "<li><a href='$LINK'>$NAME</a><p>$DESC</p></li>";
echo "</ul>"
if [ -n "$TOREAD" ]; then
echo "$(getmailbody)" | mail \
-a "Content-type: text/html" \
-s "Weekly Pinboard Summary" <email address>
echo "Nothing to report. Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment