Week 24, 2021

Published: 2021-06-19 Updated: 2021-06-19 by Pradeep Gowda.
Tagged: weekly, python

Table of Contents

Monday, 2021-06-14 to Sunday, 2021-06-20


Now using this script as I alluded in the previous week to generate the From around the web section from my pinboard.in bookmarks.



Generate a list of markdown formatted stories
derived from pinboard.
(run venv/bin/pinboard-to-sqlite posts backups/pinboard.db
from the ~/btbytes dir first)

import sqlite3
from isoweek import Week

def main(fromstring=None):
    """fromstring in the form of 2021W23"""
    con = sqlite3.connect('backups/pinboard.db')
    if fromstring:
        week = Week.fromstring(fromstring)
        week = Week.thisweek()
    first = week.days()[0].strftime('%Y-%m-%d')
    last = week.days()[-1].strftime('%Y-%m-%d')
    cur = con.cursor()
    cur.execute('select href, description, time, shared, tags, extended from posts where time >= ? and time <= ? and shared=1', (first, last))
    print(f'{week}, {first} - {last}\n')
    print('## From around the web\n')
    for r in cur.fetchall():
        if '#weekly' in r[4]:
            print(f'''* [{r[1]}]({r[0]})

if __name__ == '__main__':
    import sys
    if len(sys.argv) > 1:

From around the web

« Previous week | Next week »