flak rss random

flak is activated

ActivityPub August rolls on. Now with more (some) ActivityPub support in flak.

I held off on adding it before because I wasn’t sure how deep I wanted the integration to go, and I had some doubts about how useful minimal support would be. Time to find out.

Posts are now available as activity Article objects. There’s a minimal Person actor as well, since every post needs an author, but that’s about it. I think the objects are complete enough even for fussy implementations to accept them, but one never knows.

No inbox support, no following, no replies, etc. (Strike that. we’ve got follows and deliveries and creates now. Oh my.) Getting into delivery adds a lot more code (it did) and admin maintenance (oh well). So many little commits to fix all the bugs.

Another issue is that sometimes I like to experiment with posts that include custom scripting or styling, and that’s not going to federate well. Oh well, I guess you can figure it out and click through. Or not. WASM over AP when?

Posted 24 Aug 2023 18:53 by tedu Updated: 23 May 2024 19:15
Tagged: activitypub flak web

rewriting everything in go

I’ve been a rather happy lua user for a few years. In particular, the luajit implementation. But as part of an ongoing overhaul of this and that, I decided to rewrite all my lua code in go. Or wait, let me rephrase that.

more...

Posted 11 Mar 2019 03:25 by tedu Updated: 11 Mar 2019 15:42
Tagged: flak go

moving to https

The time has finally come to switch everything to https. Actually, I’ve been using https for a while, but now it’s time to inflict, er invite, everyone else along for the ride.

more...

Posted 18 Jul 2017 15:12 by tedu Updated: 21 Jul 2017 22:29
Tagged: flak security thoughts web

humungus

Every once in a while somebody asks if they can run flak, and the answer is usually some variant of no, not right now, but maybe after I’m done rewriting it four times. Well, it’s been stuck at rewrite number 3 for quite a while, so time to push the button. Of course, putting code on the internet requires a place to put it, but Microsoft shut down Codeplex. Guess I have to build my own.

more...

Posted 01 Apr 2017 01:41 by tedu Updated: 01 Apr 2017 02:27
Tagged: flak project software

flak archive

I’ve skirted around the issue of paging flak for some time. It’s not that it’s hard; it’s quite easy. Easy to do wrong, that is. As explained here page numbers should start at 1 for old posts. That part is easy, but it leaves open the question of what to put on the last (highest numbered) page.

Lacking an obvious technical solution, I turned to rationalizing the absence of the feature as a feature in its own right. Without an easy way to dig through old posts, I needn’t worry about keeping their content updated. Old posts naturally fade away and decompose.

There’s also a certain psychological trick involved, call it the pot of gold at the end of the rainbow. There’s the implied promise of posts worth reading, if only you knew the right search terms to find them. A wonderful conceit.

Ah, well, all good things must end. Punting on the issue of paging, I redefined the problem. There’s now a one page flak archive. Minimal info to keep it small, should scale for the next few years without too much trouble.

Posted 08 May 2014 18:52 by tedu Updated: 08 May 2014 18:52
Tagged: flak web

banned parameters

I was reviewing the flak logs the other day (chasing an unrelated issue) when I noticed lots of requests with additional parameters, like utm_campaign=twitter. Huh? I’m not running any campaigns. GTFO.

I find these tracker tags in URLs annoying when other sites do it. It’s not the tracking that bothers me, but the fact that the URLs end up being long and ugly, and it means there’s several URLs for the same content. I much prefer canonical URLS. Different tracking URLs break duplicate detection on various link sharing sites, and trick the browser’s history feature. Boo.

Of course, it’s your site, you do what you want, but this is my site, so don’t dick with my URLs. To that end, flak now filters out extraneous parameters by driving you through a bounce screen. Hopefully this prevents the further sharing and posting of the infected URLs.

Try it out.

Posted 27 Jan 2014 01:11 by tedu Updated: 19 Jul 2015 22:08
Tagged: flak rants web

flak is back

Last night, a flak link escaped into the twitterverse where it was discovered by a “Google-HTTP-Java-Client/1.17.0-rc (gzip)” (whatever that is), which then proceeded to send flak a serious of cruel and unusual requests. Like the unique snowflake it is, flak’s HTTP parsing is rather delicate. In this case, sending a cookie without a value invoked the dreaded “table index is nil” error and crashed the process. Now, flak cannot be laid low by any one rogue request because it is powered by a whole host of processes, but after the relentless onslaught of four such requests, everything was dead.

Bug fixed. Another related bug found and fixed. And we’re back online. Until the next bug.

Posted 30 Nov 2013 16:50 by tedu Updated: 30 Nov 2013 18:14
Tagged: flak software web

pyggy the simple pygments server

flak uses pygments to generate the pretty highlighted code blocks. The original approach was to just shell out to the command line tool, but the performance is, ah, suboptimal. Caching mostly saves me, but at 0.1 secs per execution, highlighting five small samples pushes the initial page render up to half a second. Searching the intertubes for a pygments server didn’t reveal much. (The top hit is a random sample of highlighted code, not a highligher itself, and the other hits don’t seem very useful either.)

So here’s pyggy. It’s really simple. It listens on a port. You feed it a language, a length, and some code. It returns a length and some highlighted html. It’s not configurable. Maybe someone will find it useful.

import socket
import pygments
from pygments import formatters,lexers

html = formatters.get_formatter_by_name("html", noclasses=True, nowrap=True)
getlexer = lexers.get_lexer_by_name
highlight = pygments.highlight

serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serv.bind(('127.0.0.1', 7878))
serv.listen(10)

while True:
        con, addr = serv.accept()
        try:
                fd = con.makefile()
                lang = fd.readline().strip()
                amt = int(fd.readline())
                code = fd.read(amt)

                rv = ""
                try:
                        lex = getlexer(lang)
                        rv = highlight(code, lex, html)
                except:
                        pass

                fd.write(str(len(rv)))
                fd.write("\n")
                fd.write(rv)
                fd.close()
        except:
                pass
        con.close()

pyggy.py

Posted 03 May 2013 14:57 by tedu Updated: 10 Oct 2014 00:38
Tagged: flak programming python web

flak upgrade

The only thing more fun than talking about yourself is talking about the blog platform you use to talk about yourself. I rolled out some flak upgrades today and it almost worked. I did learn one critical lesson about sqlite which may be interesting, after that the post devolves into useless trivia.

more...

Posted 09 Mar 2013 23:25 by tedu Updated: 21 Apr 2013 05:38
Tagged: flak programming web

rss

Maybe it works now. With correct links even.

Posted 08 Oct 2012 01:20 by tedu Updated: 08 Oct 2012 01:20
Tagged: flak