Jan Erik Moström


MBPC day 9: Bloom. What can I say? This tree looks different when it blooms.

MBPC day 8: Union. A photo I snapped many years ago.

MBPC day 7: Park. The parks here are NOT impressive at the moment

Ojojoj, hur ska detta gå

MBPC day 6: Silhouette. Visiting places where I haven’t been in 20 years or so.

MBPC day 5: Earth. This evening I was informed that this is our new kitchen garden.

MBPC day 4: Thorny. Spring is so ugly

Daily life viewed from above

MBPC day 3: Experimental. Being uninspired I decided to try a longtime exposure. Result: a huge “meh”

MBPC day 2: Photo. I should print more

MBPC day 1: Switch. Trying out an ereader to see if I should switch

I thought I would make another attempt to use mastodon and I’m wondering if there is any advantage to get a user on a “special interest” server? I currently have a mastodon.social account but would it be a better experience to have an account on another server?

Hmmm, I downloaded the mastodon iOS app and I think it’s slightly confused. Three languages in one dialog … two isn’t uncommon but three isn’t something I see every day

It’s important to enjoy whatever snow that is left (he loves snow).

Hmmm. I decided to remove all photos from my Flickr account and start over. Once I had deleted all photos, I went to bed, when I got up I had two new followers … for an empty account. It has been a while since I got a new follower so two new in a short time is very surprising

Restarted my micro.blog account recently, now severely tempted to restart my Flickr account also.

Thursday morning, “brain staff” haven’t all arrived to work yet

Today’s most interesting photo was a 4 generation photo: granddaughter, son, wife and father in law. I love that we are able to catch photos like this. (And no, I didn’t include a photo)

Så sant

It looks like it’s going to take awhile before I can go to bed. Can’t disturb this sleeping beauty

Another visit to the disciplinary board (I wasn’t the accused!!) … when I took this job 17-18 months ago I was told “max one case per year”. Hmmm, I’ve had 20+ cases with 30+ students involved. It’s equally sad every time.

Väntar på att bilen ska få sommardäck 😁

Micro.blog to blot script

Just so I remember this in case I ever need it again

# This script assumes it's launched from inside the micro.blog export folder

import frontmatter
import os
import re
import shutil
from dateutil import parser

basedir = '/Users/jem/Desktop/TestOutput'
imgpat = re.compile('')
domainpat = re.compile('https:.*/uploads/')
blothead = 'title: {}\ndate: {}\n\n'

# I really dislike doing this but ...
imgdata = {'destdir':'',}

def copyimage(src,dest):
    shutil.copy(os.path.join('uploads',src), os.path.join(imgdata['destdir'],dest))
    
def imgproc(m):
    orgpath = m.group(1)
    
    # Remove domain info
    p = domainpat.sub('',orgpath)
    n = '_'+os.path.basename(p)
    copyimage(p,n)
    return '![]('+n+')'

def formatblotpost(post):
    # Update content and copy image files
    modifiedcontent = imgpat.sub(imgproc,post.content)
    if post.metadata['title'] == '':
        post.metadata['title'] = post.metadata['datetitle']
    return blothead.format(post.metadata['title'],post.metadata['date']) + modifiedcontent
        
def create_destdir(newbase,curfilepath,poststamp):
    (odir,oname) = os.path.split(curfilepath)
    newdir = os.path.join(newbase,odir)
    # Check if the dest dir exists, this should be the year & month folder
    if not os.path.isdir(newdir):
        os.makedirs(newdir)
    postdir = os.path.join(newdir,poststamp)
    # This should not be possible but ...
    if os.path.isdir(postdir):
        raise Exception('Post dir already exists')
    else:
        os.mkdir(postdir)
    return postdir

def handlepost( destdir, source ):
    print(source)
    
    try:
        postcontent = frontmatter.load(source)
        meta = postcontent.metadata
        pdate = parser.parse(meta['date'])
        pdir = create_destdir(destdir,source,pdate.strftime('%Y%m%d_%H%M%S'))
        postcontent['datetitle']= pdate.strftime('%Y-%m-%d %H:%M:%S')
        # Deep sigh
        imgdata['destdir'] = pdir

        # Create actual post
        of = open(os.path.join(pdir,'index.md'),'w')
        of.write(formatblotpost(postcontent))
        of.close()
    except FileNotFoundError as arg:
        print(arg)

for root, dirs, files in os.walk('.'):
    if not 'uploads' in root:
        for f in files:
            if not '.DS_Store' in f:
                handlepost(basedir,os.path.join(root,f))

Detta tyckte jag var lite sött, en kursplan med följande innehåll

Kursen ger studenten grundläggande generella färdigheter i problemlösning och programmering i ett lämpligt nybörjarspråk med skyddsnät

Inte alltid ett skyddsnät ingår

I needed a walk today so I persuaded a friend to come along (the persuasion consisted of holding up the collar 😋)