diff --git a/.gitignore b/.gitignore index d556b87..ca16980 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ index.html blog-tmp.html public/index.html public/rss.xml +mdf-blog diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf446d5 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +- If using a precompiled version of mdf-blog, place the `mdf-blog` executable + in this directory (project root). +- Use `./new.sh` to create new blogpost in ./blogs. This will open your + editor defined by the EDITOR environment variable. +- Use `./run.sh` to generate all output files in "./public" +- Use `USERNAME="your username" PASSWORD="your password" ./push.sh` to + push to server. diff --git a/blogs/day6.md b/blogs/day6.md index f574318..9baac1f 100644 --- a/blogs/day6.md +++ b/blogs/day6.md @@ -3,6 +3,7 @@ author: Rakarake pubDate: Fri, Mar 27 2026 --- Warframe. +Erm, yeah. ![a spinning golden banana](./golden-banana.gif "Oh Banana") diff --git a/blogs/day7.md b/blogs/day7.md index 2814f1a..218064e 100644 --- a/blogs/day7.md +++ b/blogs/day7.md @@ -1,5 +1,6 @@ -title: A statement +title: Infrastructure complete author: Rakarake -pubDate: Fri, Mar 27 2026 +pubDate: Sat, Mar 28 2026 --- -Kyuuuuuuu! 🐳 +It's been done 🐍🥰💕. + diff --git a/blogs/day8.md b/blogs/day8.md new file mode 100644 index 0000000..fcd57bf --- /dev/null +++ b/blogs/day8.md @@ -0,0 +1,5 @@ +title: We love slop +author: Rakarake +pubDate: Sat, Mar 28 2026 +--- +🐖🐖 diff --git a/blogs/day9.md b/blogs/day9.md new file mode 100644 index 0000000..d8f8bff --- /dev/null +++ b/blogs/day9.md @@ -0,0 +1,9 @@ +title: NEW MDF MEMBER IN AGES +author: Rakarake +pubDate: Wed, Apr 1 2026 +--- +Welcome Loriik! + +Huge moment for the MDF, the interview process was long and tedious. +Hundreds of candidates. Many work hours. (real). + diff --git a/flake.lock b/flake.lock index 6f8bad3..e3816b4 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -66,28 +50,11 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1771043024, - "narHash": "sha256-O1XDr7EWbRp+kHrNNgLWgIrB0/US5wvw9K6RERWAj6I=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3aadb7ca9eac2891d52a9dec199d9580a6e2bf44", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-25.11", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay", - "zig-overlay": "zig-overlay" + "rust-overlay": "rust-overlay" } }, "rust-overlay": { @@ -122,42 +89,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "flake": false, - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "zig-overlay": { - "inputs": { - "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs_3", - "systems": "systems_2" - }, - "locked": { - "lastModified": 1772540502, - "narHash": "sha256-HXlx2i9gGH2HKfBSMihKCvU6DQMVlR4iyOulkSOe+Cg=", - "owner": "mitchellh", - "repo": "zig-overlay", - "rev": "03fa375def0685b8ce282f118452532845f16a20", - "type": "github" - }, - "original": { - "owner": "mitchellh", - "repo": "zig-overlay", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 4b0b867..84f3dd5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,13 @@ { - description = "Rust flake"; + description = "mdf-blog"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # or whatever vers flake-utils.url = "github:numtide/flake-utils"; rust-overlay.url = "github:oxalica/rust-overlay"; - zig-overlay.url = "github:mitchellh/zig-overlay"; }; - outputs = { self, nixpkgs, flake-utils, rust-overlay, zig-overlay, ... }: + outputs = { nixpkgs, flake-utils, rust-overlay, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; @@ -17,33 +16,20 @@ }; in { - devShell = pkgs.mkShell rec { - LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}"; + defaultPackage = pkgs.rustPlatform.buildRustPackage { + name = "mdf-blog"; + pname = "mdf-blog"; + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + }; + devShell = pkgs.mkShell { packages = with pkgs; [ rustc cargo rust-analyzer - gcc - zig-overlay.packages."x86_64-linux".master - ]; - buildInputs = with pkgs; [ - libdisplay-info - libgbm - #mesa - libinput - pixman - seatd - udev - libxkbcommon - wayland - wayland.dev - wayland-protocols - libGL - vulkan-headers vulkan-loader - vulkan-tools vulkan-tools-lunarg - vulkan-extension-layer - vulkan-validation-layers # don't need them *strictly* but immensely helpful - #libglvnd + curl ]; }; } diff --git a/new.sh b/new.sh new file mode 100755 index 0000000..94810cd --- /dev/null +++ b/new.sh @@ -0,0 +1,8 @@ +#!/bin/sh +git pull + +printf "name of file (e.g. day67.md): " +read filename +cargo run -- new > blogs/$filename +$EDITOR blogs/$filename + diff --git a/push.sh b/push.sh new file mode 100755 index 0000000..8bddad4 --- /dev/null +++ b/push.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +git add blogs +git commit -m "blog update" +git push + +for file in $(find public -type f) +do + echo "uploading: $file" + curl -u "$USER:$PASSWORD" https://mdf.farm/api/${file#*/} --upload-file $file +done + diff --git a/run.sh b/run.sh index 7f08741..a5d9d19 100755 --- a/run.sh +++ b/run.sh @@ -1,8 +1,12 @@ #/bin/sh -cargo run -- html blogs/* > blog-tmp.html +cargo build && cp target/debug/mdf-blog . || true + +BLOGS=$(ls $PWD/blogs/*) + +./mdf-blog html $BLOGS > blog-tmp.html sed template.html -e '/INSERT_HERE/{ r blog-tmp.html d }' > public/index.html -cargo run -- rss blogs/* > public/rss.xml +./mdf-blog rss $BLOGS > public/rss.xml diff --git a/src/main.rs b/src/main.rs index b2b39f2..00dc41e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,11 @@ use std::{collections::HashMap, io, path::Path}; use markdown::to_html; -use rss::{Channel, GuidBuilder, ItemBuilder}; +use rss::{Channel, ChannelBuilder, GuidBuilder, Item, ItemBuilder}; -fn main() -> io::Result<()> { +fn main() -> Result<(), String> { let posts = std::env::args().skip(2).map(|f| { - let contents = std::fs::read_to_string(f.clone())?; + let contents = std::fs::read_to_string(f.clone()).map_err(|e| format!("when reading file {f} got {e}"))?; + // parse metadata, then the rest to html let mut metadata: HashMap = contents.lines().take_while(|l| { // header ends here @@ -26,35 +27,36 @@ fn main() -> io::Result<()> { }).concat(); Ok((to_html(&body), metadata)) - }).collect::)>, io::Error>>()?; + }).collect::)>, String>>()?; if let Some(mode) = std::env::args().skip(1).next() { match mode.as_str() { "rss" => { - let mut channel = Channel::default(); - channel.title = "MDF blog huge".to_string(); - channel.link = "https://mdf.farm".to_string(); - channel.description = "The MDF blog".to_string(); - channel.generator = Some("Rakabaka's tooling".to_string()); - channel.items = posts.iter().map(|(body, metadata)| { - let guid = metadata.get("guid").map(|guid| - GuidBuilder::default() - .value(guid) - .permalink(false) - .build() - ); - ItemBuilder::default() - .title(metadata.get("title").map(|title| title.clone())) - .description(Some(body.clone())) - .pub_date(metadata.get("pubDate").map(|title| title.clone())) - .link(metadata.get("guid").map(|g| format!("https://mdf.farm/#{g}"))) - .guid(guid) - .build() - }).collect(); + let channel = ChannelBuilder::default() + .title("MDF blog huge".to_string()) + .link("https://mdf.farm".to_string()) + .description("The MDF blog".to_string()) + .generator(Some("Rakabaka's tooling".to_string())) + .items(posts.iter().map(|(body, metadata)| { + let guid = metadata.get("guid").map(|guid| + GuidBuilder::default() + .value(guid) + .permalink(false) + .build() + ); + ItemBuilder::default() + .title(metadata.get("title").map(|title| title.clone())) + .description(Some(body.clone())) + .pub_date(metadata.get("pubDate").map(|title| title.clone())) + .link(metadata.get("guid").map(|g| format!("https://mdf.farm/#{g}"))) + .guid(guid) + .build() + }).collect::>()) + .build(); print!("{}", channel); }, "html" => { - print!("{}", posts.iter().enumerate().map(|(i, (body, metadata))| { + print!("{}", posts.iter().rev().enumerate().map(|(i, (body, metadata))| { let guid = metadata.get("guid").unwrap_or(&i.to_string()).clone(); let title = metadata.get("title").map(|title| format!("

{title}

")).unwrap_or("".to_string()); let pub_date = metadata.get("pubDate").map(|pub_date| format!("{pub_date}")).unwrap_or("".to_string()); diff --git a/upload.sh b/upload.sh deleted file mode 100755 index 730c2c4..0000000 --- a/upload.sh +++ /dev/null @@ -1 +0,0 @@ -rsync -rvz -e 'ssh -p 8022' --progress public/* rakarake@chat.mdf.farm:/data/website