commit 92787c159262a57fa20b2eb05ed710e1e6cfca96 parent e12c0d23ad72ffa9389d90311453db535f57e450 Author: Martin Ashby <martin@ashbysoft.com> Date: Mon, 25 Mar 2024 21:36:21 +0000 Final conversion to Zine Diffstat:
98 files changed, 436 insertions(+), 405 deletions(-)
diff --git a/.hugo_build.lock b/.hugo_build.lock diff --git a/.lfsconfig b/.lfsconfig @@ -1,3 +0,0 @@ -[lfs] -url = "http://rpi3:8082/" - diff --git a/Caddyfile b/Caddyfile @@ -9,7 +9,7 @@ } http://localhost:8080 { - root * public + root * zig-out import robots @@ -18,6 +18,9 @@ http://localhost:8080 { env NOTIFICATION_ADDRESS=martin@mfashby.net SMTP_SERVER=mail.mfashby.net:587 SMTP_USERNAME=comments@mfashby.net SMTP_PASSWORD=foobar DATABASE_URL=postgresql://localhost/comments } + # Treat posts as home + redir / /posts/ temporary + # Redirects for old assets redir /10-11-21-longboard-slides.mp4 /assets/10-11-21-longboard-slides.mp4 permanent redir /apex_1.jpg /assets/apex_1.jpg permanent diff --git a/README.md b/README.md @@ -1,4 +1,5 @@ -# server +mfashby.net +=========== -Web server to act as frontend for mfashby.net +Personal blog at [mfashby.net](https://mfashby.net) diff --git a/build.zig b/build.zig @@ -7,8 +7,8 @@ pub fn build(b: *std.Build) !void { .content_dir_path = "content", .static_dir_path = "static", .site = .{ - .base_url = "https://sample.com", - .title = "Sample Website", + .base_url = "https://mfashby.net", + .title = "mfashby.net", }, }); } \ No newline at end of file diff --git a/comments/build.zig.zon b/comments/build.zig.zon @@ -9,7 +9,7 @@ .hash = "1220b85b46b525e725f8fdb6e23189aa365976acf388e3b2a5a4da364851c3ec4252", }, .mustache = .{ .url = "https://github.com/batiati/mustache-zig/archive/refs/heads/master.tar.gz", - .hash = "122099facef1728bd1118fac3a9444f5daca7278046e734a25f03f7e20bad2b5cb28", + .hash = "12205538be57d7c0b92806e87c500c50bfcecb9b083adea8b2fdbec99f46598c922d", }, .zigwebserver = .{ .url = "https://code.mfashby.net/zigwebserver/snapshot/zigwebserver-main.tar.xz", .hash = "122084fc67129e92544a86f10ca9a64f2667682aa7dfd6a12a80c374015a33555df6", diff --git a/comments/src/main.zig b/comments/src/main.zig @@ -130,16 +130,16 @@ const router = Rtr{ /// Run as a CGI program! pub fn main() !void { const allocator = gpa.allocator(); - const db_url = std.os.getenv("DATABASE_URL") orelse "postgresql://comments@localhost/comments"; + const db_url = std.posix.getenv("DATABASE_URL") orelse "postgresql://comments@localhost/comments"; var db = try pq.Db.init(db_url); // try db.exec(@embedFile("migrations/0_init.sql")); // try db.exec(@embedFile("migrations/1_capcha.sql")); defer db.deinit(); const req = Request{ - .method = std.meta.stringToEnum(std.http.Method, std.os.getenv("REQUEST_METHOD") orelse "GET") orelse { + .method = std.meta.stringToEnum(std.http.Method, std.posix.getenv("REQUEST_METHOD") orelse "GET") orelse { return error.InvalidRequestMethod; }, - .target = std.os.getenv("REQUEST_URI") orelse "/", + .target = std.posix.getenv("REQUEST_URI") orelse "/", }; var res = Response{ .allocator = allocator, @@ -211,7 +211,7 @@ fn get_comment(res: *Response, ctx: Ctx, _: Params) Err!void { } fn post_comment(res: *Response, ctx: Ctx, _: Params) Err!void { - const cl = if (std.os.getenv("CONTENT_LENGTH")) |clh| try std.fmt.parseInt(usize, clh, 10) else { + const cl = if (std.posix.getenv("CONTENT_LENGTH")) |clh| try std.fmt.parseInt(usize, clh, 10) else { return error.InvalidLength; }; const body = try res.allocator.alloc(u8, cl); @@ -268,10 +268,10 @@ fn post_comment(res: *Response, ctx: Ctx, _: Params) Err!void { .author = form_val.author, .comment = form_val.comment, }); - const smtp_username = std.os.getenv("SMTP_USERNAME") orelse "comments@mfashby.net"; - const smtp_password = std.os.getenv("SMTP_PASSWORD") orelse "foobar"; - const notification_address = std.os.getenv("NOTIFICATION_ADDRESS") orelse "martin@mfashby.net"; - const smtp_server = std.os.getenv("SMTP_SERVER") orelse "mail.mfashby.net:587"; + const smtp_username = std.posix.getenv("SMTP_USERNAME") orelse "comments@mfashby.net"; + const smtp_password = std.posix.getenv("SMTP_PASSWORD") orelse "foobar"; + const notification_address = std.posix.getenv("NOTIFICATION_ADDRESS") orelse "martin@mfashby.net"; + const smtp_server = std.posix.getenv("SMTP_SERVER") orelse "mail.mfashby.net:587"; smtp.send_mail(res.allocator, smtp_server, .{ .user = smtp_username, .pass = smtp_password }, smtp_username, &[_][]const u8{notification_address}, notification) catch |err| { std.log.err("failed to send notification email {}", .{err}); }; diff --git a/config.toml b/config.toml @@ -1,19 +0,0 @@ -baseURL = 'https://mfashby.net/' -languageCode = 'en-gb' -title = 'mfashby.net' -theme = "XMin" - -[[menu.main]] -name = "home" -url = "" -weight = 1 - -[[menu.main]] -name = "about" -url = "about/" -weight = 2 - -[[menu.main]] -name = "rss" -url = "index.xml" -weight = 3 -\ No newline at end of file diff --git a/content/_index.md b/content/_index.md @@ -1,5 +0,0 @@ ---- -title: Home ---- - -# mfashby.net diff --git a/content/about/_index.md b/content/about/_index.md @@ -1,9 +0,0 @@ ---- -title: "About" -date: 2024-03-01T23:59:52Z -draft: false ---- - -Hi, my name's Martin. - -I write about software engineering and other stuff. -\ No newline at end of file diff --git a/content/about/cv.md b/content/about/cv.md @@ -1,7 +1,8 @@ --- -title: "CV" -date: 2024-03-02T00:06:37Z -draft: false +.title = "CV", +.author = "Martin Ashby", +.date = @date("2024-03-02T00:06:37Z"), +.layout = "single.html", --- # Martin Ashby - Software Engineer diff --git a/content/about/index.md b/content/about/index.md @@ -0,0 +1,10 @@ +--- +.title = "About", +.author = "Martin Ashby", +.date = @date("2024-03-01T23:59:52Z"), +.layout = "list.html", +--- + +Hi, my name's Martin. + +I write about software engineering and other stuff. +\ No newline at end of file diff --git a/content/posts/2018-05-31-new-site.md b/content/posts/2018-05-31-new-site.md @@ -1,9 +1,9 @@ --- -layout: post -title: "New Site" -date: 2018-05-31 17:51:07 +0100 -params: - comments: true +.title = "New Site", +.author = "Martin Ashby", +.date = @date("2018-05-31T17:51:07+0100"), +.layout = "single.html", +.custom = {"comments": true}, --- I'm intending to write more online about the stuff I tinker with. diff --git a/content/posts/2018-06-01-mailu.md b/content/posts/2018-06-01-mailu.md @@ -1,14 +1,14 @@ --- -layout: post -title: "Mailu" -date: 2018-06-01 20:17:00 +0100 -params: - comments: true +.title = "Mailu", +.author = "Martin Ashby", +.date = @date("2018-06-01T20:17:00+0100"), +.layout = "single.html", +.custom = {"comments": true}, --- ## My search for an email server -![Rainloop Screenshot](/assets/mailu_screenshot.png) +![Rainloop Screenshot](assets/mailu_screenshot.png) A big theme in the news recently is data protection, how your personal data is being used (and abused), and taking back control of your data. Part of the problem is that people's personal data is kept in huge private corporate networks, and historically companies have been able to do (essentially) whatever they like with it. I started investigating how difficult it would be to really re-take control of my personal data - beginning with my email. diff --git a/content/posts/2018-06-02-unicornpaint.md b/content/posts/2018-06-02-unicornpaint.md @@ -1,13 +1,13 @@ --- -layout: post -title: "Unicorn Paint" -date: 2018-06-02 22:33:00 +0100 -params: - comments: true +.title = "Unicorn Paint", +.author = "Martin Ashby", +.date = @date("2018-06-02T22:33:00+0100"), +.layout = "single.html", +.custom = {"comments": true}, --- See [unicornpaint] for details. I'll write about this later... -![animated image](/assets/unicorn.gif) +![animated image](assets/unicorn.gif) [unicornpaint]:https://unicorn.mfashby.net diff --git a/content/posts/2021-09-17-restart.md b/content/posts/2021-09-17-restart.md @@ -1,9 +1,9 @@ --- -title: "Restart" -date: 2021-09-17T23:41:39+01:00 -draft: false -params: - comments: true +.title = "Restart", +.author = "Martin Ashby", +.date = @date("2021-09-17T23:41:39+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I'll restart blogging, likely in the form of micro-blogs restricted to just a few sentences. (like twitter) diff --git a/content/posts/2021-09-18-maddy.md b/content/posts/2021-09-18-maddy.md @@ -1,9 +1,9 @@ --- -title: "Maddy" -date: 2021-09-18T22:05:32+01:00 -draft: false -params: - comments: true +.title = "Maddy", +.author = "Martin Ashby", +.date = @date("2021-09-18T22:05:32+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- Since my [last post on mail servers](https://mfashby.net/posts/2018-06-01-mailu/), the [maddy](https://maddy.email/) email server has advanced significantly, and now includes enough functionality to be a useful mail server adhering to current best practices. This includes DKIM, spam filtering with rspamd, virtual user management and more. diff --git a/content/posts/2021-09-19-longboard-setup.md b/content/posts/2021-09-19-longboard-setup.md @@ -1,12 +1,12 @@ --- -title: "Longboard Setup" -date: 2021-09-19T10:20:49+01:00 -draft: false -params: - comments: true +.title = "Longboard Setup", +.author = "Martin Ashby", +.date = @date("2021-09-19T10:20:49+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- -![Longboard](/assets/longboard.jpg) +![Longboard](assets/longboard.jpg) I recently picked up longboarding. I enjoy snowboarding, but in the current pandemic + climate change it's looking less sustainable as a hobby, so I'm learning downhill longboarding. diff --git a/content/posts/2021-09-21-manjaro.md b/content/posts/2021-09-21-manjaro.md @@ -1,9 +1,9 @@ --- -title: "Manjaro" -date: 2021-09-21T20:03:48+01:00 -draft: false -params: - comments: true +.title = "Manjaro", +.author = "Martin Ashby", +.date = @date("2021-09-21T20:03:48+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I've used [Ubuntu](https://ubuntu.com/) linux for many years, but just recently it's started to become a bit more difficult due to proliferation of package managers. With the introduction of snap, flatpak, I'm never quite sure where I should be getting my software from. diff --git a/content/posts/2021-09-26-pine64.md b/content/posts/2021-09-26-pine64.md @@ -1,9 +1,9 @@ --- -title: "Pine64" -date: 2021-09-26T16:39:28+01:00 -draft: false -params: - comments: true +.title = "Pine64", +.author = "Martin Ashby", +.date = @date("2021-09-26T16:39:28+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I bought a [Pinebook Pro](https://www.pine64.org/pinebook-pro/) some while back, and I'm quite happy with it. It has a nice small form factor, decent display, nice shell, and reasonable battery life. When I first bought it software support was somewhat sketchy, however most linux distributions and even OpenBSD now have support for it, so I'm hoping I can keep using it for a number of years. I have even managed to do some dayjob (software development) work with it. diff --git a/content/posts/2021-09-29-bike.md b/content/posts/2021-09-29-bike.md @@ -1,9 +1,9 @@ --- -title: "Bike" -date: 2021-10-01T12:27:26+01:00 -draft: false -params: - comments: true +.title = "Bike", +.author = "Martin Ashby", +.date = @date("2021-10-01T12:27:26+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently refurbished my bike for use as a commuter. I work at home, but I need to commute my daughter to nursery a couple of days a week. It's also handy to be able to increase my range without having to use the car, as traffic around the area can get bad. @@ -14,4 +14,4 @@ For my daughter, I fitted an [Oxford little explorer](https://www.argos.co.uk/pr Probably the next thing I'll need to upgrade are some lights. I bought some small silicone ones but these quickly died as they allowed water into the battery compartment. I'll likely get some helmet mounted ones as well as ones for the actual bike, and reflective strips for the back seat to try to maximise visibility. After that I would also like to upgrade the brakes. I've got rim-brakes with fairly large pads, but something with a bit more stopping power would be nice. -![Bike](/assets/bike.jpg) +![Bike](assets/bike.jpg) diff --git a/content/posts/2021-09-29-recipe.md b/content/posts/2021-09-29-recipe.md @@ -1,9 +1,9 @@ --- -title: "Recipe" -date: 2021-09-29T22:56:01+01:00 -draft: false -params: - comments: true +.title = "Recipe", +.author = "Martin Ashby", +.date = @date("2021-09-29T22:56:01+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I found [plainoldrecipe](https://github.com/poundifdef/plainoldrecipe) a while back, I find it really handy for some recipe sites which are full of cookie banners and ads, it makes them much easier to read on a phone or small laptop while I'm actually trying to cook. diff --git a/content/posts/2021-10-01-blog.md b/content/posts/2021-10-01-blog.md @@ -1,9 +1,9 @@ --- -title: "Blog" -date: 2021-10-01T19:34:15+01:00 -draft: false -params: - comments: true +.title = "Blog", +.author = "Martin Ashby", +.date = @date("2021-10-01T19:34:15+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I originally started this blog using [Jekyll](https://jekyllrb.com/), but I've since switched to using [hugo](https://gohugo.io/) after I found it simpler to install and use (`pamac install hugo` on manjaro linux). diff --git a/content/posts/2021-10-06-clojure.md b/content/posts/2021-10-06-clojure.md @@ -1,9 +1,9 @@ --- -title: "Clojure" -date: 2021-10-06T21:35:37+01:00 -draft: false -params: - comments: true +.title = "Clojure", +.author = "Martin Ashby", +.date = @date("2021-10-06T21:35:37+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I'm learning [Clojure](https://clojure.org) on the basis that you should learn something that will change your way of thinking. I've previously stuck to C-family languages, and I work professionally with Java. diff --git a/content/posts/2021-10-30-openbsd.md b/content/posts/2021-10-30-openbsd.md @@ -1,9 +1,9 @@ --- -title: "OpenBSD" -date: 2021-10-30T20:25:43+01:00 -draft: false -params: - comments: true +.title = "OpenBSD", +.author = "Martin Ashby", +.date = @date("2021-10-30T20:25:43+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I've tried installing & using [OpenBSD](https://openbsd.org/) 7.0 on my Pinebook Pro. I've previously used OpenBSD on a small VPS just to try it out, and I was quite impressed. diff --git a/content/posts/2021-11-05-postgres-query-rewrite.md b/content/posts/2021-11-05-postgres-query-rewrite.md @@ -1,9 +1,9 @@ --- -title: "Postgres Query Rewrite" -date: 2021-11-05T11:57:12Z -draft: false -params: - comments: true +.title = "Postgres Query Rewrite", +.author = "Martin Ashby", +.date = @date("2021-11-05T11:57:12Z"), +.layout = "single.html", +.custom = {"comments": true}, --- Recently at work, I needed to be able to rewrite some [postgresql](https://www.postgresql.org/) queries which were coming from a closed-source application in order to integrate the app into our own system testing setup. Specifically I needed to replace instances of `current_timestamp` with invocation of `now()` function. diff --git a/content/posts/2021-11-09-longboard-2.md b/content/posts/2021-11-09-longboard-2.md @@ -1,9 +1,9 @@ --- -title: "Longboard 2" -date: 2021-11-09T21:56:41Z -draft: false -params: - comments: true +.title = "Longboard 2", +.author = "Martin Ashby", +.date = @date("2021-11-09T21:56:41Z"), +.layout = "single.html", +.custom = {"comments": true}, --- Since my last post on longboarding, I've been learning to [push up slide](https://downhill254.com/how-to-push-up-slide-longboarding/) and [coleman slide](https://downhill254.com/coleman-slide-for-longboard-downhill-pendulum-slide/). These are essential skills to control your speed so you can safely tackle steeper and longer hills. @@ -12,5 +12,5 @@ I've also made a couple of hardware changes - switched to [powell peralta snakes](https://newtons-shred.co.uk/shop/skateboards/wheels/cruiser-filmer/powell-peralta-snakes-red-66mm-75a/), following many many reviews on [reddit](https://teddit.net/r/longboarding) - added [freebrake brake soles](https://newtons-shred.co.uk/shop/safety/other/footbraking-sole/freebrake-longboard-skateboard-footbraking-sole-4mm-pair/) to my shoes. I had nearly worn through the heel and toe on my right foot from frequent braking. These appear to be up-cycled car tyres! -{{< video src="/assets/10-11-21-longboard-slides.mp4" type="video/mp4" preload="auto" >}} +{{< video src="assets/10-11-21-longboard-slides.mp4" type="video/mp4" preload="auto" >}} diff --git a/content/posts/2021-11-14-backups.md b/content/posts/2021-11-14-backups.md @@ -1,9 +1,9 @@ --- -title: "Backups" -date: 2021-11-14T11:12:44Z -draft: false -params: - comments: true +.title = "Backups", +.author = "Martin Ashby", +.date = @date("2021-11-14T11:12:44Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've recently setup a full system backup for my raspberry pi home server, backing up to my NAS over NFS. Working backups give me the confidence to use it for more critical things like email, calendar and contacts. diff --git a/content/posts/2021-12-04-contacts.md b/content/posts/2021-12-04-contacts.md @@ -1,9 +1,9 @@ --- -title: "Contacts" -date: 2021-12-04T15:05:47Z -draft: false -params: - comments: true +.title = "Contacts", +.author = "Martin Ashby", +.date = @date("2021-12-04T15:05:47Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I'm now using [radicale](https://radicale.org/) for calendar and contacts. This was very easy to install and configure in manjaro linux. I'm using this in conjunction with [radicale-imap](https://github.com/r3c/radicale-imap) plugin for authentication. Eventually I might look at an SSO solution for the variety of services I have installed on my server. diff --git a/content/posts/2021-12-28-chat-server-protocol.md b/content/posts/2021-12-28-chat-server-protocol.md @@ -1,9 +1,9 @@ --- -title: "Chat Server Protocol" -date: 2021-12-28T22:22:01Z -draft: false -params: - comments: true +.title = "Chat Server Protocol", +.author = "Martin Ashby", +.date = @date("2021-12-28T22:22:01Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I wrote a previous post about [clojure](/posts/2021-10-06-clojure/) where I expressed an intent to write a slack clone using the language. Like most ideas, this didn't go anywhere, however it did spawn a new idea: Chat Server Protocol. diff --git a/content/posts/2022-02-11-philosophy-software-dev.md b/content/posts/2022-02-11-philosophy-software-dev.md @@ -1,9 +1,9 @@ --- -title: "Book - Philosophy Of Software Design" -date: 2022-02-11T19:18:07Z -draft: false -params: - comments: true +.title = "Book - Philosophy Of Software Design", +.author = "Martin Ashby", +.date = @date("2022-02-11T19:18:07Z"), +.layout = "single.html", +.custom = {"comments": true}, --- This is my short list of ideas I've taken away from reading [a Philosophy of Software Design](https://www.goodreads.com/en/book/show/39996759-a-philosophy-of-software-design) by John Ousterhout. diff --git a/content/posts/2022-02-23-wordle.md b/content/posts/2022-02-23-wordle.md @@ -1,9 +1,9 @@ --- -title: "Wordle" -date: 2022-02-23T13:41:22Z -draft: false -params: - comments: true +.title = "Wordle", +.author = "Martin Ashby", +.date = @date("2022-02-23T13:41:22Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I really enjoyed playing [wordle](https://www.powerlanguage.co.uk/wordle/) recently, and I really appreciated how simple and fun the game is. I enjoyed comparing my scores with my friends and family; it's also fun to see people learning new words! diff --git a/content/posts/2022-03-19-wildcard.md b/content/posts/2022-03-19-wildcard.md @@ -1,9 +1,9 @@ --- -title: "Wildcard" -date: 2022-03-19T13:17:26Z -draft: false -params: - comments: true +.title = "Wildcard", +.author = "Martin Ashby", +.date = @date("2022-03-19T13:17:26Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've switched to using a wildcard certificate for everything I host on `*.mfashby.net`. diff --git a/content/posts/2022-03-27-fossil.md b/content/posts/2022-03-27-fossil.md @@ -1,9 +1,9 @@ --- -title: "Fossil" -date: 2022-03-27T11:28:31+01:00 -draft: false -params: - comments: true +.title = "Fossil", +.author = "Martin Ashby", +.date = @date("2022-03-27T11:28:31+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I have switched to using [fossil SCM](https://fossil-scm.org) for managing the source code of this website. I am attracted to the idea of having a decentralized store not only for code but also for tickets, wiki, forums / chat, etc etc. Basically everything github provides, but capable of offline working. diff --git a/content/posts/2022-04-30-longboard-3.md b/content/posts/2022-04-30-longboard-3.md @@ -1,9 +1,9 @@ --- -title: "Longboard 3" -date: 2022-04-30T19:49:39+01:00 -draft: false -params: - comments: true +.title = "Longboard 3", +.author = "Martin Ashby", +.date = @date("2022-04-30T19:49:39+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- Since my [last post](/2021-11-09-longboard-2/) on longboarding, I've become a lot more comfortable with push-up and coleman slides, and now I aim to learn [toeside pendulum slide](https://youtu.be/a5B_XaubQNE). I have had limited success so far, and one bad high-side attempting it (fall down-hill direction, as opposed to low-side falling in the uphill direction). Luckily my helmet did it's job, I'll be trying again in the future. @@ -18,6 +18,6 @@ This particular board has caliber II (reverse king pin) trucks. I've swapped the Much more importantly, I've found a fellow longboarder to skate with, and a couple of new spots nearby. Videos to follow! -![Apex Diamond Drop Top](/assets/apex_1.jpg) -![Apex Diamond Drop Bottom](/assets/apex_2.jpg) +![Apex Diamond Drop Top](assets/apex_1.jpg) +![Apex Diamond Drop Bottom](assets/apex_2.jpg) diff --git a/content/posts/2022-05-07-stolen-focus.md b/content/posts/2022-05-07-stolen-focus.md @@ -1,9 +1,9 @@ --- -title: "Book - Stolen Focus" -date: 2022-05-07T15:18:58+01:00 -draft: false -params: - comments: true +.title = "Book - Stolen Focus", +.author = "Martin Ashby", +.date = @date("2022-05-07T15:18:58+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I've recently finished reading [Stolen Focus](stolenfocusbook.com/) by Johann Hari. diff --git a/content/posts/2022-06-09-rustlings.md b/content/posts/2022-06-09-rustlings.md @@ -1,9 +1,9 @@ --- -title: "Rustlings" -date: 2022-06-09T21:58:40+01:00 -draft: false -params: - comments: true +.title = "Rustlings", +.author = "Martin Ashby", +.date = @date("2022-06-09T21:58:40+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently completed the [rustlings](https://github.com/rust-lang/rustlings/) introduction to learning the [Rust](https://www.rust-lang.org/) programming language. diff --git a/content/posts/2022-07-09-longboard-4.md b/content/posts/2022-07-09-longboard-4.md @@ -1,9 +1,9 @@ --- -title: "Longboard 4" -date: 2022-07-09T22:00:07+01:00 -draft: false -params: - comments: true +.title = "Longboard 4", +.author = "Martin Ashby", +.date = @date("2022-07-09T22:00:07+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- Since the [last](/posts/2022-04-30-longboard-3/) post on longboarding, I've started skating at the local park with a friend. Park skating is pretty different to downhill & freeride! It's a lot of fun. It challenges you to think about how you're going to navigate the park (what line you'll take), and pushes the boundaries of what you are capable of. It also looks awesome :) diff --git a/content/posts/2022-07-30-fossil2.md b/content/posts/2022-07-30-fossil2.md @@ -1,9 +1,9 @@ --- -title: "Fossil 2" -date: 2022-07-30T22:57:38+01:00 -draft: false -params: - comments: true +.title = "Fossil 2", +.author = "Martin Ashby", +.date = @date("2022-07-30T22:57:38+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I tidied up [my github](https://github.com/MFAshby) and archived a bunch of old repositories. The few that I have kept, I have moved to my [self-hosted fossil](https://code.mfashby.net), and I have enabled a few useful options there like [login-groups](https://fossil-scm.org/home/doc/trunk/www/caps/login-groups.md) and correctly setting base URL and individual repository paths within fossil. diff --git a/content/posts/2022-09-09-serverless.md b/content/posts/2022-09-09-serverless.md @@ -1,9 +1,9 @@ --- -title: "Serverless" -date: 2022-09-09T21:48:19+01:00 -draft: false -params: - comments: true +.title = "Serverless", +.author = "Martin Ashby", +.date = @date("2022-09-09T21:48:19+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- At work, our main product is a web application. Its primary function is receiving health data from hospital systems (and GP systems, and anyone else that has health data) and making it available to patients. I've been heavily involved in the infrastructure side of things; including migration to public cloud infrastructure. diff --git a/content/posts/2022-09-25-back-to-git.md b/content/posts/2022-09-25-back-to-git.md @@ -1,9 +1,9 @@ --- -title: "Back to Git" -date: 2022-09-25T21:09:31+01:00 -draft: false -params: - comments: true +.title = "Back to Git", +.author = "Martin Ashby", +.date = @date("2022-09-25T21:09:31+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I moved back to git from fossil SCM, after [previously](posts/2022-03-27-fossil/) migrating the other way. diff --git a/content/posts/2022-10-07-blocky.md b/content/posts/2022-10-07-blocky.md @@ -1,9 +1,9 @@ --- -title: "Blocky" -date: 2022-10-07T20:24:03+01:00 -draft: false -params: - comments: true +.title = "Blocky", +.author = "Martin Ashby", +.date = @date("2022-10-07T20:24:03+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently revisited the idea of installing [pi-hole](https://pi-hole.net/) in my local network to help remove ads from miscellaneous devices on my network. However, my raspberry pi already runs a lot of stuff including this blog, and runs on an unsupported-by-pi-hole OS (manjaro linux). diff --git a/content/posts/2022-10-09-quine.md b/content/posts/2022-10-09-quine.md @@ -1,9 +1,9 @@ --- -title: "Quine" -date: 2022-10-09T13:11:52+01:00 -draft: false -params: - comments: true +.title = "Quine", +.author = "Martin Ashby", +.date = @date("2022-10-09T13:11:52+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- A [quine](https://en.wikipedia.org/wiki/Quine_%28computing%29) is a program that takes no input, and it's output is it's own source code. A quine-relay is a program that outputs the source code for another program, and when that next program is run it outputs the source code of the first program. I recently saw [this quine relay](https://github.com/mame/quine-relay) program which was super impressive as it goes through 128 languages like this! diff --git a/content/posts/2022-10-09-skateboard-1.md b/content/posts/2022-10-09-skateboard-1.md @@ -1,9 +1,9 @@ --- -title: "Skateboard 1" -date: 2022-10-09T13:21:00+01:00 -draft: false -params: - comments: true +.title = "Skateboard 1", +.author = "Martin Ashby", +.date = @date("2022-10-09T13:21:00+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- Following my [previous post](posts/2022-07-09-longboard-4/) on longboarding, I took a few more trips to the skate park. I eventually decided to buy a regular (or 'popsicle') board as they really open up a lot more of the park, and tricks. @@ -14,5 +14,5 @@ I went through several sets of bushings until finally settling on [bones hardcor Finally; I bought a skate-tool. Previously I'd been carrying a socket-wrench around in my bag, and it wasn't super convenient. The skate tool fits in my pocket so I can pack lighter :) -![Skateboard](/assets/skateboard.jpg) -{{< video src="/assets/drop-in.mp4" type="video/mp4" preload="auto" >}} -\ No newline at end of file +![Skateboard](assets/skateboard.jpg) +{{< video src="assets/drop-in.mp4" type="video/mp4" preload="auto" >}} +\ No newline at end of file diff --git a/content/posts/2022-10-14-blogsite.md b/content/posts/2022-10-14-blogsite.md @@ -1,9 +1,9 @@ --- -title: "Blogsite" -date: 2022-10-14T22:59:01+01:00 -draft: false -params: - comments: true +.title = "Blogsite", +.author = "Martin Ashby", +.date = @date("2022-10-14T22:59:01+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I was thinking about this blog and how it's set up. I [covered](posts/2021-10-01-blog/) the setup in a previous post, but it's quite simple: the site is generated from markdown files with [hugo](https://gohugo.io/) and published to git. The server pulls from git on a schedule, rebuilds it and copies it to the web server directory. diff --git a/content/posts/2022-10-14-caddy.md b/content/posts/2022-10-14-caddy.md @@ -1,9 +1,9 @@ --- -title: "Caddy" -date: 2022-10-14T22:58:22+01:00 -draft: false -params: - comments: true +.title = "Caddy", +.author = "Martin Ashby", +.date = @date("2022-10-14T22:58:22+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I switched to [caddy](https://caddywebserver.com) from nginx. Caddy has a 'simpler' configuration syntax, and offers built-in automatic TLS support with letsencrypt. I've also enabled automatic TLS support in [maddy](https://maddy.email) mail server, and I have been able to remove certbot entirely from my home server and disable the cron job that refreshed certs! diff --git a/content/posts/2022-10-15-blogsite2.md b/content/posts/2022-10-15-blogsite2.md @@ -1,9 +1,9 @@ --- -title: "Blogsite 2" -date: 2022-10-15T22:39:18+01:00 -draft: false -params: - comments: true +.title = "Blogsite 2", +.author = "Martin Ashby", +.date = @date("2022-10-15T22:39:18+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I made another [small experiment](https://blogsite2.mfashby.net/) [source](https://code.mfashby.net/martin/blogsite2) to do my blog yet another way; rather than using hugo static site generation, I can leverage Caddy server's built-in [template rendering](https://caddyserver.com/docs/caddyfile/directives/templates) and markdown support to serve markdown files 'directly' without a pre-build step. diff --git a/content/posts/2022-12-04-aoc.md b/content/posts/2022-12-04-aoc.md @@ -1,9 +1,9 @@ --- -title: "Advent of Code" -date: 2022-12-04T08:54:56Z -draft: false -params: - comments: true +.title = "Advent of Code", +.author = "Martin Ashby", +.date = @date("2022-12-04T08:54:56Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I'm having a go at [Advent Of Code](https://adventofcode.com/2022) this year, this time [writing solutions in Rust](https://code.mfashby.net/martin/aoc2022). diff --git a/content/posts/2022-12-20-longboard-5.md b/content/posts/2022-12-20-longboard-5.md @@ -1,15 +1,15 @@ --- -title: "Longboard 5" -date: 2022-12-20T14:16:49Z -draft: false -params: - comments: true +.title = "Longboard 5", +.author = "Martin Ashby", +.date = @date("2022-12-20T14:16:49Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've been stuck inside with the cold weather recently. However, I've also discovered [Ampskate](https://www.ampskate.com/tricks) which is a great little guide for learning longboard dance and freestyle. Here's a little clip: -{{< video src="/assets/skate4.mp4" type="video/mp4" preload="auto" >}} +{{< video src="assets/skate4.mp4" type="video/mp4" preload="auto" >}} Which is my attempt at a [cross-step](https://www.ampskate.com/tricks/cross-step). My goal is to learn the [ghostride kickflip](https://www.ampskate.com/tricks/ghostride-kickflip). \ No newline at end of file diff --git a/content/posts/2022-12-26-spotifyd.md b/content/posts/2022-12-26-spotifyd.md @@ -1,9 +1,9 @@ --- -title: "Spotifyd" -date: 2022-12-26T23:08:03Z -draft: false -params: - comments: true +.title = "Spotifyd", +.author = "Martin Ashby", +.date = @date("2022-12-26T23:08:03Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently discovered [spotifyd](https://spotifyd.github.io/), an open source alternative to the deprecated libspotify. I happened to also have a [pi-zero W](https://www.raspberrypi.com/news/raspberry-pi-zero-w-joins-family/) from a while back, and a [pHAT DAC](https://learn.pimoroni.com/article/raspberry-pi-phat-dac-install) amplifier. diff --git a/content/posts/2022-12-30-comments.md b/content/posts/2022-12-30-comments.md @@ -1,9 +1,9 @@ --- -title: "Comments" -date: 2022-12-30T17:53:00Z -draft: false -params: - comments: true +.title = "Comments", +.author = "Martin Ashby", +.date = @date("2022-12-30T17:53:00Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've added an extremely basic, probably insecure, comments form to my blog site. I've built it in Rust for practice. Code is [here](https://code.mfashby.net/martin/mfashby.net/src/branch/main/comments). diff --git a/content/posts/2022-12-31-cgit.md b/content/posts/2022-12-31-cgit.md @@ -1,9 +1,9 @@ --- -title: "Cgit" -date: 2022-12-31T23:39:38Z -draft: false -params: - comments: true +.title = "Cgit", +.author = "Martin Ashby", +.date = @date("2022-12-31T23:39:38Z"), +.layout = "single.html", +.custom = {"comments": true}, --- In a [previous post](posts/2022-09-25-back-to-git/) I switched back from fossil to git. I found [gitea](https://gitea.io/) to be a pretty good server. However, it has many features I do not use, and it takes a minimum of 15% of the RAM on my Raspberry Pi home server! I found a simpler setup. diff --git a/content/posts/2023-01-31-oso.md b/content/posts/2023-01-31-oso.md @@ -1,9 +1,9 @@ --- -title: "Authorization and search operations" -date: 2023-01-31T21:14:06Z -draft: false -params: - comments: true +.title = "Authorization and search operations", +.author = "Martin Ashby", +.date = @date("2023-01-31T21:14:06Z"), +.layout = "single.html", +.custom = {"comments": true}, --- Background: at work I help to build a [SAAS](https://en.wikipedia.org/wiki/Software_as_a_service) web application for healthcare. An important aspect of our web application is [authorization](https://csrc.nist.gov/glossary/term/authorization). It's a pretty hard problem, because the business has a fairly complex set of rules about who can see what data. The rules involve attributes of the [subject](https://csrc.nist.gov/glossary/term/subject) and [object](https://csrc.nist.gov/glossary/term/object), and the direct or indirect (e.g. via a group) relationship between them. It's also a pretty important problem; healthcare data is typically very sensitive and we need to obey the law and keep our users' trust in order to provide useful services. The problem is also constrained by speed; in order to render a web page in a reasonable time e.g. under a second, data must be fetched and authorized in just a few milliseconds. diff --git a/content/posts/2023-02-05-book-site-reliability-engineering.md b/content/posts/2023-02-05-book-site-reliability-engineering.md @@ -1,9 +1,9 @@ --- -title: "Book - Site Reliability Engineering" -date: 2023-02-05T15:53:43Z -draft: false -params: - comments: true +.title = "Book - Site Reliability Engineering", +.author = "Martin Ashby", +.date = @date("2023-02-05T15:53:43Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've read [Site Reliability Engineering](https://sre.google/sre-book/table-of-contents/) (SRE) from Google/O'Reilly. It's an interesting insight into how Google scales their operations work. diff --git a/content/posts/2023-02-05-semantic-dissonance.md b/content/posts/2023-02-05-semantic-dissonance.md @@ -1,9 +1,9 @@ --- -title: "Semantic Dissonance" -date: 2023-02-05T16:38:55Z -draft: false -params: - comments: true +.title = "Semantic Dissonance", +.author = "Martin Ashby", +.date = @date("2023-02-05T16:38:55Z"), +.layout = "single.html", +.custom = {"comments": true}, --- A while ago I read [Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/). It was too long ago to write a review, however the phrase that I first encountered in that book and has stuck with me since is 'semantic dissonance'. In the field of software development, this means that we have two (or more!) _incompatible_ models of the same real-world situation. This happens a lot in healthcare IT. The latest and greatest standard for data exchange is [Fast Healthcare Interoperability Records](https://hl7.org/fhir/) (FHIR). Many healthcare IT suppliers are being pushed towards exposing their data over this standardised format, and they have to handle mapping from their own internal models to the standard and back again. These mappings are sometimes irreversible, i.e. mapping forward then backward again does not result in the same exact result as the input. They might also be lossy; i.e. a concept exists in one model which does not exist in the other at all, or a concept with a similar meaning but subtly different exists. diff --git a/content/posts/2023-04-09-designing-data-intensive-applications.md b/content/posts/2023-04-09-designing-data-intensive-applications.md @@ -1,9 +1,9 @@ --- -title: "Book - Designing Data Intensive Applications" -date: 2023-04-09T21:45:01+01:00 -draft: false -params: - comments: true +.title = "Book - Designing Data Intensive Applications", +.author = "Martin Ashby", +.date = @date("2023-04-09T21:45:01+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- [Link](https://www.oreilly.com/library/view/designing-data-intensive-applications/9781491903063/) to the book. diff --git a/content/posts/2023-06-16-bike.md b/content/posts/2023-06-16-bike.md @@ -1,9 +1,9 @@ --- -title: "Bike 2" -date: 2023-06-16T21:04:31+01:00 -draft: false -params: - comments: true +.title = "Bike 2", +.author = "Martin Ashby", +.date = @date("2023-06-16T21:04:31+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I haven't posted about my bike for a while; there have been a couple of changes. @@ -12,5 +12,5 @@ Firstly; the [freehub](https://en.wikipedia.org/wiki/Freehub) broke, which put i The other difference is a recently purchased [followme tandem](https://www.thelittlebikecompany.co.uk/product/followme-tandem/) set to connect my daughter's bike to mine. She is outgrowing the seat on my cycle but she's too young to ride on roads and not confident to ride her own yet. The followme seems like a good bridge to get her used to pedalling and having her own seat, but we can still cover a good distance for a day out. I was inspired by the review from [cyclesprog](https://www.cyclesprog.co.uk/carrying-kids-on-bikes/bike-towbars/followme-cycle-hitch-full-review/). We tested it out today with a friend! -![Myself and daughter on followme tandem, friend on road cycle](/assets/bike2.jpg) +![Myself and daughter on followme tandem, friend on road cycle](assets/bike2.jpg) diff --git a/content/posts/2023-08-11-4-eyes.md b/content/posts/2023-08-11-4-eyes.md @@ -1,9 +1,9 @@ --- -title: "Four Eyes" -date: 2023-08-11T22:50:43+01:00 -draft: false -params: - comments: true +.title = "Four Eyes", +.author = "Martin Ashby", +.date = @date("2023-08-11T22:50:43+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- The four-eyes principle (also known as [two-man rule](https://en.wikipedia.org/wiki/Two-man_rule) or no-lone-zone) stipulates that for certain very critical operations like the launch of a nuclear weapon or the handling of very sensitive cryptographic key material, at least two qualified persons must be actively involved. diff --git a/content/posts/2023-08-22-comments-2.md b/content/posts/2023-08-22-comments-2.md @@ -1,9 +1,9 @@ --- -title: "Comments 2" -date: 2023-08-22T14:48:41+01:00 -draft: false -params: - comments: true +.title = "Comments 2", +.author = "Martin Ashby", +.date = @date("2023-08-22T14:48:41+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- [Previously](/posts/2022-12-30-comments/) I added a basic comment system to my website using a separate web server which served only the comment HTML. This is fine, but it does require another program running continuously on my server. Since that server is a raspberry pi, and it is running a lot of other software as well, and my blog doesn't get a lot of hits (let alone comments), I thought I could do better by using the [Common Gateway Interface (CGI)](https://en.wikipedia.org/wiki/Common_Gateway_Interface). CGI doesn't require a daemon program, but instead will launch a program to generate dynamic content when someone loads the page. In this way, no memory or CPU is required until an actual page is requested. The downside is that a new process is launched for each page load, but I think that's an OK trade-off for me. I already have CGI configured on my web server for running [cgit](/posts/2022-12-31-cgit/). diff --git a/content/posts/2023-09-12-mcl.md b/content/posts/2023-09-12-mcl.md @@ -1,9 +1,9 @@ --- -title: "Mcl (minecraft launcher)" -date: 2023-09-12T07:03:15+01:00 -draft: false -params: - comments: true +.title = "Mcl (minecraft launcher)", +.author = "Martin Ashby", +.date = @date("2023-09-12T07:03:15+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I wrote a [minecraft launcher](https://code.mfashby.net/mcl/about/) in [zig](ziglang.org/) as a learning exercise. diff --git a/content/posts/2023-10-01-parable-of-the-sower.md b/content/posts/2023-10-01-parable-of-the-sower.md @@ -1,9 +1,9 @@ --- -title: "Book - Parable of the Sower / Parable of the Talents" -date: 2023-10-01T22:23:00+01:00 -draft: false -params: - comments: true +.title = "Book - Parable of the Sower / Parable of the Talents", +.author = "Martin Ashby", +.date = @date("2023-10-01T22:23:00+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- By [Octavia E Butler](https://en.wikipedia.org/wiki/Octavia_E._Butler). *Note, spoilers* diff --git a/content/posts/2023-10-07-zipdl.md b/content/posts/2023-10-07-zipdl.md @@ -1,9 +1,9 @@ --- -title: "Zipdl" -date: 2023-10-07T23:28:16+01:00 -draft: false -params: - comments: true +.title = "Zipdl", +.author = "Martin Ashby", +.date = @date("2023-10-07T23:28:16+01:00"), +.layout = "single.html", +.custom = {"comments": true}, --- I wrote a small program for downloading individual files from a remote ZIP file on a http server that supports [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) requests. This was an interesting learning exercise. diff --git a/content/posts/2023-11-25-roc.md b/content/posts/2023-11-25-roc.md @@ -1,9 +1,9 @@ --- -title: "Roc" -date: 2023-11-25T21:19:27Z -draft: false -params: - comments: true +.title = "Roc", +.author = "Martin Ashby", +.date = @date("2023-11-25T21:19:27Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I had a go at [writing some code](https://code.mfashby.net/roctorrent/tree/main.roc) in the [Roc](https://www.roc-lang.org/) programming language. It's a functional programming language, which is statically typed, and compiled to a standalone executable. I first heard about it after listening to an interview with it's author on the [Legacy Code Rocks](https://legacycode.rocks/) podcast, and later thought about it again after seeing a comment about it on [hacker news](https://news.ycombinator.com/). diff --git a/content/posts/2023-11-26-skateboard-2.md b/content/posts/2023-11-26-skateboard-2.md @@ -1,18 +1,15 @@ --- -title: "Skateboard 2" -date: 2023-11-26T20:33:27Z -draft: false -params: - comments: true +.title = "Skateboard 2", +.author = "Martin Ashby", +.date = @date("2023-11-26T20:33:27Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I've been skating indoors at [LS-ten skatepark](https://ls-ten.org/) recently, as the poor weather over the last few weeks has made outdoor skating... not fun. I've mostly abandoned my shorter board in favour of the [Lush Throttle](https://lushlongboards.com/buy/throttle/). At 34" length it's not too much longer than a typical 'popsicle' board, but I find it much more comfortable. I don't mind the lack of double kicktail, and I prefer the longer wheelbase. I've been working on the basics of skating ramps and bowls - drop-ins, roll-ins, kick turns, rock-to-fakie, and tail stall; and I'm still quite rough as you can see in the following video. I hope to continue skating regularly and improving. -{{< rawhtml >}} <iframe title="mini ramp fun" width="560" height="315" src="https://tube.spdns.org/videos/embed/415b33b3-80ed-4d60-8063-e7a9492dab59" frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"></iframe> -{{< /rawhtml >}} - (on a technical note, I've signed up for a peertube instance and I'm posting my skate videos there. I have the content backed up locally as well, but I figured I might avoid hosting videos from my home server for now) \ No newline at end of file diff --git a/content/posts/2023-12-01-aoc2023.md b/content/posts/2023-12-01-aoc2023.md @@ -1,9 +1,9 @@ --- -title: "Advent of Code 2023" -date: 2023-12-01T21:42:21Z -draft: false -params: - comments: true +.title = "Advent of Code 2023", +.author = "Martin Ashby", +.date = @date("2023-12-01T21:42:21Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I'm doing [Advent of Code](https://adventofcode.com) again this year, this time in [Zig](https://ziglang.org). diff --git a/content/posts/2024-01-26-data-oriented-design.md b/content/posts/2024-01-26-data-oriented-design.md @@ -1,9 +1,9 @@ --- -title: "Book - Data Oriented Design" -date: 2024-01-26T20:19:31Z -draft: false -params: - comments: true +.title = "Book - Data Oriented Design", +.author = "Martin Ashby", +.date = @date("2024-01-26T20:19:31Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently read [Data Oriented Design](https://www.dataorienteddesign.com/dodbook/) by Richard Fabian. diff --git a/content/posts/2024-01-26-dyn.md b/content/posts/2024-01-26-dyn.md @@ -1,9 +1,9 @@ --- -title: "Dynamic DNS" -date: 2024-01-26T00:02:35Z -draft: false -params: - comments: true +.title = "Dynamic DNS", +.author = "Martin Ashby", +.date = @date("2024-01-26T00:02:35Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I recently upgraded my home broadband, however in the process I lost my static IP address. I have requested a new one, but in the meantime I wrote a [program](https://code.mfashby.net/do-dyn/file/src/main.zig.html) to dynamically update my DNS records in case my router restarts and my WAN IP address changes. diff --git a/content/posts/2024-02-01-1brc.md b/content/posts/2024-02-01-1brc.md @@ -1,9 +1,9 @@ --- -title: "1brc" -date: 2024-02-01T13:58:47Z -draft: false -params: - comments: true +.title = "1brc", +.author = "Martin Ashby", +.date = @date("2024-02-01T13:58:47Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I [had a go](https://code.mfashby.net/z1brc/file/src/main.zig.html) at the [One Billion Row Challenge](https://github.com/gunnarmorling/1brc), but in Zig rather than Java. diff --git a/content/posts/2024-02-05-phones.md b/content/posts/2024-02-05-phones.md @@ -1,9 +1,9 @@ --- -title: "Fairphone" -date: 2024-02-05T19:56:17Z -draft: false -params: - comments: true +.title = "Fairphone", +.author = "Martin Ashby", +.date = @date("2024-02-05T19:56:17Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I bought a [fairphone 4](https://shop.fairphone.com/fairphone-4) just under 2 years ago. I'm pleased to say last week I repaired it! I had accidentally filled the pocket on my jeans with sand on holiday, and then I put the phone in the pocket. The USB-C on the bottom of the phone got sand in it, and stopped holding a cable correctly. It just about worked for charging still, but the cable would pop out very easily, and this was pretty inconvenient. I tried a few ways to clear it out, with no success. diff --git a/content/posts/2024-03-01-communication.md b/content/posts/2024-03-01-communication.md @@ -1,9 +1,9 @@ --- -title: "Communication" -date: 2024-03-01T14:40:50Z -draft: false -params: - comments: true +.title = "Communication", +.author = "Martin Ashby", +.date = @date("2024-03-01T14:40:50Z"), +.layout = "single.html", +.custom = {"comments": true}, --- I believe that in software development, being open and working in the open are crucial to wellbeing and efficiency; even moreso when working remotely. There are 3 things that I think should be communicated: intention, struggle, and progress. Communications should be clear, public, searchable, and regular. This post explains my thoughts on the subject. diff --git a/content/posts/2024-03-03-catb.md b/content/posts/2024-03-03-catb.md @@ -1,9 +1,10 @@ --- -title: "Book - The Cathedral and the Bazaar" -date: 2024-03-03T19:31:27Z -draft: false -params: - comments: true +.title = "Book - The Cathedral and the Bazaar", +.author = "Martin Ashby", +.date = @date("2024-03-03T19:31:27Z"), +.layout = "single.html", +.custom = {"comments": true}, +.description = "Book review 'The Cathedral and the Bazaar'" --- I recently read [The Cathedral and the Bazaar](https://www.catb.org/~esr/writings/cathedral-bazaar/) by Eric S Raymond. diff --git a/static/assets/10-11-21-longboard-slides.mp4 b/content/posts/assets/10-11-21-longboard-slides.mp4 Binary files differ. diff --git a/static/assets/apex_1.jpg b/content/posts/assets/apex_1.jpg Binary files differ. diff --git a/static/assets/apex_2.jpg b/content/posts/assets/apex_2.jpg Binary files differ. diff --git a/static/assets/bike.jpg b/content/posts/assets/bike.jpg Binary files differ. diff --git a/static/assets/bike2.jpg b/content/posts/assets/bike2.jpg Binary files differ. diff --git a/static/assets/drop-in.mp4 b/content/posts/assets/drop-in.mp4 Binary files differ. diff --git a/static/assets/longboard.jpg b/content/posts/assets/longboard.jpg Binary files differ. diff --git a/static/assets/mailu_screenshot.png b/content/posts/assets/mailu_screenshot.png Binary files differ. diff --git a/static/assets/reprap.jpg b/content/posts/assets/reprap.jpg Binary files differ. diff --git a/static/assets/skate4.mp4 b/content/posts/assets/skate4.mp4 Binary files differ. diff --git a/static/assets/skateboard.jpg b/content/posts/assets/skateboard.jpg Binary files differ. diff --git a/static/assets/unicorn.gif b/content/posts/assets/unicorn.gif Binary files differ. diff --git a/static/assets/unicorn1.jpg b/content/posts/assets/unicorn1.jpg Binary files differ. diff --git a/static/assets/unicorn2.jpg b/content/posts/assets/unicorn2.jpg Binary files differ. diff --git a/static/assets/unicorn3.jpg b/content/posts/assets/unicorn3.jpg Binary files differ. diff --git a/static/assets/unicorn_small.gif b/content/posts/assets/unicorn_small.gif Binary files differ. diff --git a/content/posts/index.md b/content/posts/index.md @@ -0,0 +1,10 @@ +--- +.title = "mfashby.net", +.author = "Martin Ashby", +.date = @date("1900-01-01T00:00:00Z"), +.layout = "list.html", +.alternatives = [{ + .layout = "rss.xml", + .output = "index.xml", +}], +--- diff --git a/converter/build.zig b/converter/build.zig @@ -10,8 +10,8 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); - // const zig_yaml = b.dependency("zig-yaml", .{}); - // exe.root_module.addImport("yaml", zig_yaml.module("yaml")); + const ziggy = b.dependency("ziggy", .{}); + exe.root_module.addImport("ziggy", ziggy.module("ziggy")); b.installArtifact(exe); diff --git a/converter/build.zig.zon b/converter/build.zig.zon @@ -2,11 +2,10 @@ .name = "converter", .version = "0.0.0", .dependencies = .{ - // It doesn't work! - //.@"zig-yaml" = .{ - // .url = "https://github.com/kubkon/zig-yaml/archive/refs/heads/main.tar.gz", - // .hash = "122084941d6e06491a85e1356c7cca24a078103d34155e34a10a16a53f420d6bc37b", - //}, + .ziggy = .{ + .url = "https://github.com/kristoff-it/ziggy/archive/refs/heads/main.tar.gz", + .hash = "1220037474a924385b0d2ccb0e5c416c595f43f93a3450d55f8b6d5ad6f3ba091ca5", + } }, .paths = .{ "", diff --git a/converter/convert_posts.zig b/converter/convert_posts.zig diff --git a/converter/src/main.zig b/converter/src/main.zig @@ -1,8 +1,23 @@ const std = @import("std"); +const ziggy = @import("ziggy"); + +const Page = struct { + title: ?[]const u8 = null, + author: ?[]const u8 = null, + date: ?[]const u8 = null, + layout: ?[]const u8 = null, + // draft: ?bool = null, + // params: ?struct { + // comments: bool, + // } = null, +}; pub fn main() !void { const a = std.heap.page_allocator; - const contentdir = try std.fs.cwd().openDir("../content", .{.iterate = true}); + var args = std.process.args(); + if (!args.skip()) @panic("errors kipping program name?"); + const contentdirname = args.next() orelse return error.NoDir; + const contentdir = try std.fs.cwd().openDir(contentdirname, .{ .iterate = true }); var walker = try contentdir.walk(a); while (try walker.next()) |we| { if (std.mem.endsWith(u8, we.basename, ".md")) { @@ -11,7 +26,7 @@ pub fn main() !void { const start = (std.mem.indexOf(u8, file, "---\n") orelse return error.NoFrontmatter) + 4; const end = (std.mem.lastIndexOf(u8, file, "---\n") orelse return error.NoFrontMatter); - var childproc = std.process.Child.init(&.{"yq", "-o", "json"}, a); + var childproc = std.process.Child.init(&.{ "yq", "-o", "json" }, a); childproc.stdin_behavior = .Pipe; childproc.stdout_behavior = .Pipe; childproc.stderr_behavior = .Pipe; @@ -33,9 +48,23 @@ pub fn main() !void { return error.ProcessError; } const fm_json = try stdout.toOwnedSlice(); - const newfile = try std.mem.concat(a, u8, &.{"---\n", fm_json, file[end..]}); + // Now parse it and add missing fields + const fm_json_parsed_value = try std.json.parseFromSlice(Page, a, fm_json, .{ + .ignore_unknown_fields = true, + }); + defer fm_json_parsed_value.deinit(); + var fm_json_parsed = fm_json_parsed_value.value; + fm_json_parsed.title = fm_json_parsed.title orelse ""; + fm_json_parsed.author = fm_json_parsed.author orelse "Martin Ashby"; + fm_json_parsed.date = fm_json_parsed.date orelse "1900-01-01T00:00:00Z"; + fm_json_parsed.layout = fm_json_parsed.layout orelse "single.html"; + + var out = std.ArrayList(u8).init(a); + defer out.deinit(); + try ziggy.stringify(fm_json_parsed, .{.whitespace = .space_2}, out.writer()); + const newfile = try std.mem.concat(a, u8, &.{ "---\n", out.items, "\n", file[end..] }); try we.dir.writeFile(we.basename, newfile); } } std.log.info("done!", .{}); -} -\ No newline at end of file +} diff --git a/deploy.sh b/deploy.sh @@ -3,7 +3,7 @@ set -e # Build static site -hugo +zig build # Build comments app pushd comments @@ -15,12 +15,8 @@ fi zig build -Doptimize=ReleaseSafe -Dcpu=baseline popd -# TODO update caddy with offline message while site being updated - # Copy static site -rsync -rz public/* root@rpi3:/var/www/mfashby.net +#rsync -rz zig-out/* root@rpi3:/var/www/mfashby.net # Copy comments app -rsync comments/zig-out/bin/comments root@rpi3:/usr/local/bin/comments - -# TODO set caddy back to online +#rsync comments/zig-out/bin/comments root@rpi3:/usr/local/bin/comments diff --git a/layouts/list.html b/layouts/list.html @@ -4,9 +4,9 @@ <p var="$page.content"></p> - <ul> - <li loop="$site.pages()"> - <span class="date" var="$loop.it.date.format('02-Jan-2006')"></span> + <ul loop="$page.subpages()"> + <li> + <span class="date" var="$loop.it.date.format('2006/01/02')"></span> <a href="$loop.it.permalink()" var="$loop.it.title"></a> </li> </ul> diff --git a/layouts/rss.xml b/layouts/rss.xml @@ -0,0 +1,20 @@ +<rss version="2.0" + xmlns:atom="http://www.w3.org/2005/Atom" + xmlns:content="http://purl.org/rss/1.0/modules/content/"> + <channel> + <title>Home on mfashby.net</title> + <link>https://mfashby.net/</link> + <description>Recent content in Home on mfashby.net</description> + <language>en-gb</language> + <lastBuildDate>Sun, 03 Mar 2024 19:31:27 +0000</lastBuildDate> + <atom:link href="https://mfashby.net/index.xml" rel="self" type="application/rss+xml"/> + <item inline-loop="$page.subpages()"> + <title var="$loop.it.title"></title> + <link var="$loop.it.permalink()"></link> + <pubDate var="$loop.it.date.formatHTTP()"></pubDate> + <guid isPermaLink="true" var="$loop.it.permalink()"></guid> + <description var="$loop.it.description"></description> + <content:encoded var="$loop.it.content"></content:encoded> <!-- This doesn't work, an empty tag is emitted --> + </item> + </channel> +</rss> +\ No newline at end of file diff --git a/layouts/single.html b/layouts/single.html @@ -1,8 +1,16 @@ -<extend template="main.html"> +<extend template="main.html"/> <div id="main"> <div class="article-meta"> - <h1><span class="title" var=$page.title></span></h1> + <h1><span class="title" var="$page.title"></span></h1> </div> + <main var="$page.content"></main> -</div> -<extend> -\ No newline at end of file + + <footer> + <div class="article-meta"> + <span class="author">Author <span var="$page.author"></span></span><br/> + <span>Updated <span class="date" var="$page.date.format('2006/01/02')"></span></span><br/> + </div> + </footer> + +</div> +\ No newline at end of file diff --git a/layouts/templates/main.html b/layouts/templates/main.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="{{ .Site.LanguageCode }}"> +<html lang="en-GB"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> @@ -11,9 +11,9 @@ <body> <nav> <ul class="menu"> - <li><a href="/">home</a></li> - <li><a href="/">about</a></li> - <li><a href="/">rss</a></li> + <li><a href="/posts">home</a></li> + <li><a href="/about">about</a></li> + <li><a href="/index.xml">rss</a></li> </ul> <hr/> </nav> @@ -23,14 +23,7 @@ </div> <footer> - {{ if or (.Params.author) (gt .Params.lastmod 0) }} - <div class="article-meta"> - {{ with .Params.author }}Author <span class="author">{{ . }}</span><br/>{{ end }} - {{ if (gt .Params.lastmod 0) }}Updated <span class="date">{{ .Lastmod.Format "January 02, 2006" }}</span><br/>{{ end }} - </div> - {{ end }} - - {{ if .Param "comments" }} + <div if="$page.custom.get('comments', false)"> <h2>comments</h2> <div style="visibility: hidden" id="comments">comments go here</div> <div style="visibility: hidden" id="comment_form">comment form goes here</div> @@ -53,7 +46,7 @@ }); </script> <noscript>Comments disabled without javascript!</noscript> - {{ end }} + </div> </footer> </body> </html> diff --git a/static/posts.zip b/static/posts.zip Binary files differ.