December 04, 2014

Further Pinboard exploration

This follows on from this post, where I try to make some sense of my Pinboard bookmarks. In the last post I looked at monthly data but I wanted to get a bit more into it, so I reworked the Python script to get daily data. (I’m using the bookmarks file as a Python learning exercise so No, I don’t expect you to be impressed with my fledgling Python skills.)

from bs4 import BeautifulSoup
import datetime

bookmarks = BeautifulSoup(open('pinboard/bookmarks.html'))
counts = dict()

for link in bookmarks.find_all('a'):
    epochdate = link.get('add_date')
    epochdate = int(epochdate)
    date = datetime.datetime.fromtimestamp(epochdate).strftime('%Y-%m-%d')
    counts[date] = counts.get(date,0) + 1

def getkey(item):
    return item[0]

results = sorted(counts.items(), key=getkey)

for day,count in results:
    print day,count

I wrote that to a marks.txt file and fed it into Gnuplot which gave me this:

Daily pinboard bookmarks

Daily pinboard bookmarks

Here’s the shell script I used for the plot.

#!/bin/sh

cat <<EOF | gnuplot
    set terminal svg font "Helvetica,11"
    set style data points
    set xdata time
    set grid
    set yrange [0:]
    set timefmt "%Y-%m-%d"
    set format x "%Y-%m"
    plot "marks.txt" using 1:2 t '' lw 3 lc rgb "#EF234D"
    EOF

The uncommonly high (123) daily import was when I ran a script to import all of my GitHub starred repos into Pinboard so I tweaked the plot to ignore it, which gave me the kind of detail I was looking for.

Detail of daily pinboard bookmarks

Detail of daily pinboard bookmarks

I’m pleased to see that the overall trend is towards fewer big spikes in links saved and I would like to see that continue. I’ve become more ‘picky’ about the links I save and have gotten into a routine of regularly weeding, pruning and generally tending them. At least once a week I go through unread items and either read and archive or read and delete them, and make sure I have tags (that make sense) on anything I’m keeping. One tool that has made life easier is Ben Beckwith’s Pintaboard, a Pinboard plugin for Pentadactyl that makes bookmarking from Firefox, with tag completion, a breeze.