After losing his job he writes articles to console himself a little.
Tips
history
From Han-dynasty scholar Zhang Heng's 《鸿赋序》: 'I am suddenly fifty… 乃为之赋,聊以自慰' ('I composed this rhapsody to comfort myself somewhat'). Zhang Heng (78-139 CE) is the same scholar-inventor who built the first seismometer.
usage
聊 here is the literary 聊 meaning 'somewhat / barely' — not 'to chat'. The whole phrase reads 'somewhat thereby self-comfort'. Always carries a slightly resigned, self-deprecating tone.