• I was tempted by the Ultra, it has a few features I find useful, but I couldn’t justify it. So I went with the regular series 8 (the battery life on my series 3/4?? is getting a bit too short for my taste).

  • Hmmm, TextExpander is apparently going to sunset their API and instead only going to support use via keyboard. I never became a “friend” of their keyboards, turned them off years ago. Feeling skeptical.

  • Intressant hur de försöker stoppa sajter med “Swish kopior”, är det inte ett problem med hela konceptet när det är så lätt att “överlista” alltihopa. Det känns ju som detta är något de borde kunna ha förutsett vid designen av hela Swish-systemet.

  • The problem with auto-correct isn’t so much that it “fixes” a few words here and there, it’s when it auto-correct in the wrong language.

  • 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?

  • 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))
    

RSS