Categories     Timeline     RSS

Motivation is overrated and so is discipline

It is Friday, the eigth of January 2021. Former US president Orange McPumpkin has attempted a coup that failed due to incompetence, even with police and (ex-?)mil support. Democrats have responded with the full force of looking into maybe discussing that there is perhaps something that someone could do. The plague is alive and well.

Anyway, I wanted to talk about being highly motivated and New Year’s resolutions. Do yourself a favor and forget about both. Statistically speaking, the lifetime of your resolutions is coming to a middle anyway, even if it were a normal year. If you’re immensely stubborn, you may get eight good weeks. Or ten. On rare occasions even half a year. But you will fail. You will have watched all the cheesy MotivationTube videos you can stomach and end up at DisciplineTube, gorging on the lessons of retired marines learned in their reductionist and ironically socialist bubble. Ah-HA, so it’s all about discipline, not motivation. But when you listen closely, it isn’t. “I do X every day at T” is not discipline, forcing yourself to do something through sheer will. It’s just a habit.

Maybe I’m a bit slow, but this seemed like a valuable insight to me. If you want to do something, don’t rely on either motivation or discipline. Both will run out. Instead, put yourself into a position to build a habit, so you don’t have to think about doing or not doing X. Have trouble getting out of bed in the morning? Always get up at the same time without exception, weekends included. Want to exercise more? Pick Mo-We-Fr and always work out at the same time. Never re-schedule. Always keep in mind, that any deviation is undoing the habit. Using discipline would be painful, why would you want to?

The web is 30 years old today

n-gate 2020-12-21:

The web is 30 years old today

December 20, 2020 (comments)

CERN would like to remind us that the Manhattan project is not the only massive research effort which led to regions of the planet being rendered entirely inhospitable to human life. The resulting comment thread serves as this week’s Hackernews Nostalgia Repository.

Watch website changes with RSS

I use the Go program below to get notifications in my RSS reader when websites change that don’t offer RSS feeds themselves. For each website you would create a new command in main(), choose a shortname, enter the URL and enter a HTML node selector for the part you are interested in (thus also excluding surrounding stuff that might be dynamically created on each visit). You would then call this program with “go run webwatcher SHORTNAME” in your RSS reader.

package main

import (
	. ""
	xnetHtml ""

const (
	DL_LIMIT     = 15 * 1024 * 1024
	CACHE_FOLDER = "cache"

const RSS_TEMPLATE string = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="">
<title><![CDATA[ {{.Shortname}} ]]></title>
<link><![CDATA[ {{.URL}} ]]></link>
<description><![CDATA[ {{.Shortname}} ]]></description>

      <title><![CDATA[ {{.URL}} ]]></title>
      <content:encoded><![CDATA[ {{.LastContent}} ]]></content:encoded>
      <guid><![CDATA[ {{.URL}}/{{.LastModified.Format "20060102-150405"}} ]]></guid>
      <link><![CDATA[ {{.URL}} ]]></link>
      <pubDate>{{.LastModified.Format "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>


func optPanic(err error) {
	if err != nil {

type command struct {
	shortname string
	URL       string
	selector  func(n *HtmlNode) bool

func (c *command) filename() string {
	return path.Join(CACHE_FOLDER, c.shortname)

func (c *command) getContent() string {
	b, err := misc.DownloadAll(c.URL, DL_LIMIT)
	tmpdoc, err := xnetHtml.Parse(bytes.NewReader(b))
	doc := (*HtmlNode)(tmpdoc)
	n := doc.Find(c.selector)
	var buf bytes.Buffer
	xnetHtml.Render(&buf, (*xnetHtml.Node)(n))
	return buf.String()

func unmarshalHPObject(filename string) HP {
	bytes, err := ioutil.ReadFile(filename)
	if err != nil {
		bytes = []byte{}
	var hpObject HP
	err = json.Unmarshal(bytes, &hpObject)
	if err != nil {
		hpObject = HP{}
	return hpObject

func marshalHPObject(filename string, hp HP) {
	bytes, err := json.MarshalIndent(hp, "", "  ")
	err = ioutil.WriteFile(filename, bytes, 0644)

func (c *command) genRSS() {
	content := c.getContent()
	hpObject := unmarshalHPObject(c.filename())
	hpObject.Shortname = c.shortname
	hpObject.URL = c.URL
	if content != hpObject.LastContent {
		hpObject.LastContent = content
		hpObject.LastModified = time.Now()
	err := rssTemplate.Execute(os.Stdout, hpObject)
	marshalHPObject(c.filename(), hpObject)

type HP struct {
	Shortname    string
	URL          string
	LastContent  string
	LastModified time.Time

var rssTemplate *template.Template

func main() {
	rssTemplate = template.Must(template.New("rss").Parse(RSS_TEMPLATE))
	os.Mkdir(CACHE_FOLDER, 0755)

	commands := []command{
		command{"stilldrinking", "", IsTag("div").And(HasID("cont"))},

	for _, command := range commands {
		if command.shortname == os.Args[1] {
	fmt.Fprintln(os.Stderr, "unknown command", os.Args[1])

Inline style block with Content Security Policy

To my surprise, it is possible to serve inline style blocks with Content Security Policy enabled:

Snippet latexpic

I uploaded a new snippet called ‘latexpic’ to my git server. It can be used to quickly generate PNGs from partial LaTeX source. It requires LaTeX, Imagemagick and Bash.


> latexpic "white on black"  '$ f(x) = e^x $ \\ $ f(\bar x) = \bar x^2 $'

… generated this:

latexpic result

< Older

Newer >