Notes for February 19-25

This week was a mixed bag all around, with some yak shaving, a refreshing amount of coding (including low-level MCU development) and quite a bit of writing.

Monday, 2024-02-19

President’s Day in the US, so it was quite a calm day. Had a bit of a giggle over one of the items my news summarizer tragically hallucinated in the morning:

reads like fantasy, smells like real
If this isn't a hallucination, I don't know what is.
  • Did some follow-up training and certification prep.
  • Did a lot of planning, writing and drafting, as well as some personal budgeting.
  • Made another attempt at doing RAG with mixtral-instruct, with somewhat better results.
  • Finally got around to fixing a number of bugs on my local, LAN-only fork of Snapdrop, which had been on my TODO for an entire year now. I still need to clean up a few things, but it was a very satisfying way to end the day.
  • So satisfactory, in fact, that I went and cherry-picked a number of things from a few public forks (will push the changes to GitHub after extended testing).

Tuesday, 2024-02-20

Yak shaving day, at work and otherwise. Sadly, after a promising start nothing much of consequence actually got done.

  • Had a mid-morning call that was quite productive for a change.
  • Went down the rabbit hole of rebuilding FreeRDP to check if the Mac client already supports dynamically resizable desktops and toggling full screen properly (spoiler: it doesn’t, and trying to fix that wasn’t feasible over lunch). The SDL client is… just not there yet, and I prefer the raw “deprecated” Cocoa client even though it has less of an UI.
  • Decided to see if my ancient CoRD fork would build (yes, there was a time when I maintained my own fork of a Remote desktop client for the Mac). But this is the age of openssl 3.x, and a lot of the code is simply obsolete, especially the gnarly bits around SSL certificate handling. I suspect I should just bite the bullet and use the freerdp library to build a new client from scratch, but that’s diminishing returns for me right now (I still hope that the official Mac client will go back to working with GFX encodings properly).
  • Did a bit more writing in the evening.
  • Decided to look at both RDP yaks again at 10pm, with the predictable result that I was up until midnight alternatively porting code to openssl 3.x and resetting my FreeRDP build tree repeatedly:
git clean -xdf
./scripts/bundle-mac-os.sh
# run client, only way to exit full screen right now is Cmd+Q and even that is broken sometimes
./install/MacFreeRDP.app/Contents/MacOS/MacFreeRDP /gfx:rfx,progressive +rfx /rfx-mode:video /sound /v:fedora.local /u:me 

Wednesday, 2024-02-21

Spent most of the day feeling under the weather.

Thursday, 2024-02-22

Dismal, rainy day. Woke up feeling more than just under the weather.

  • Personal inbox zero.
  • Spent a bit more doing some yak shaving, this time using to invoke Azure Open AI because I wanted a quick and dirty way to script it on the Mac and it is a nightmare to do HTTP requests in .

Here’s the absolute minimal example to do what I wanted (and yes, JSON handling, like ’s, leaves a lot to be desired):

import Cocoa

let url = URL(string:"https://endpoint_name.openai.azure.com/openai/deployments/deployment_name/chat/completions?api-version=2023-05-15")!,
    prompt = "Do what you are told. No more, no less."

struct Role: Codable {
    let role: String
    let content: String
}

struct Completion: Codable {
    let temperature: Float
    let messages: [Role]
}

struct Response: Codable {
    let id: String
    let object: String
    let created: Int
    let model: String
    let choices: [Choice]
    let usage: Usage
}

struct Choice: Codable {
    let finish_reason: String
    let index: Int
    let message: Message
}

struct Message: Codable {
    let role: String
    let content: String
}

struct Usage: Codable {
    let prompt_tokens: Int
    let completion_tokens: Int
    let total_tokens: Int
}

let data = Completion(
    temperature: 0.4,
    messages: [
        Role(role:"system", content: prompt),
        Role(role:"user", content: "Say Hello")
    ]
)

let encoder = JSONEncoder()
if let jsonData = try? encoder.encode(data),
   let jsonString = String(data: jsonData, encoding: .utf8) {
    var request = URLRequest(url: url);
    request.httpMethod = "POST"
    request.httpBody = jsonData
    request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")
    request.setValue("an_api_key", forHTTPHeaderField: "api-key")

    let task = URLSession.shared.dataTask(with: request) { data, response, error in
        guard let data = data, error == nil else {
            print(error?.localizedDescription ?? "No data")
            return
        }
        let decoder = JSONDecoder()
            do {
                let response = try decoder.decode(Response.self, from: data)
                print(response.choices[0].message.content)
            } catch {
                print("Error decoding JSON: \(error)")
            }

    }
        // note that this also makes it hard to handle control flow, so a synchronous approach will be better
    task.resume()
}

Friday, 2024-02-23

Woke up definitely sick after a night-long fever dream in which I went to work at what looked suspiciously like a modernized version of my old college computing centre (but set above ground and with nice windows) and sat in front of a DEC VT340 terminal that had much higher resolution graphics than I remember.

My (rather colorful) keyboard was wireless and (get this) it was my personal device, holding all my configurations and UI preferences and connecting to other people’s monitors as I went around the place talking to them and helping them do what they needed to do.

There was not a single mouse, tablet or laptop in sight. Just clean, modern monitors set up in front of each chair, and people brought their own computers/keyboards.

It was amazing. And, since it was a dream, made perfect sense, or at least more than what I woke up to.

  • Decided to make an effort to leave the house, go to the pharmacy and check if the lighting and air conditioning in the big blue room was still working.
  • Realised Stable Diffusion XL Lightning was a thing and went back indoors to play with it over lunch.
  • Spent the afternoon in a vague daze grooming my inbox and poking at work documents.
  • Had another late meeting.
  • Decided to fight whatever I was coming down with and did some manual work:
    • Disassembled and reassembled the belts, PSU and fans on my to see if I could make it quieter and get rid of the random y-axis layer shifts I’ve been seeing.
    • Did a bunch of short test prints on the Two Trees SK1 for my review.

Saturday, 2024-02-24

Woke up stupefyingly early, did some shopping/errands, ended up falling asleep on the couch mid-afternoon.

  • Did some more SK1 testing while giving another go at building a new kernel for the .
  • Set up to sync settings and game saves to my NAS (which will then back them up to Azure).
  • Consolidated my notes on writing with LLMs and .
  • Spent a while forking and trimming the CYD-Klipper code base (to re-use the awesome lvgl UI) and merging some Arduino client code to try out an idea of mine. Coding in is still so much more refreshing and concrete for me than most of the crap we have to deal with these days.

Sunday, 2024-02-25

Woke up a bit more refreshed, but still spent most of the day relaxing.

  • Cleaned up and (retroactively) posted . For good measure, added a Werner Herzog persona (plus a few others) to the mix.
  • Sowed a few pockets (sowing is, surprisingly enough, a critical engineering skill that needs to be periodically refreshed).
  • Decided to do some flow testing on the SK1 and ended up spending the afternoon grooming the configuration and doing some more test prints to tune seams (which become very noticeable when printing this fast). The Two Trees “High Speed” PLA is very good, but it’s white–which means it’s pretty hard to tune visually, and almost impossible to get decent macro shots of with a phone camera.
  • Cleaned up the office a bit, posted these notes and fixed a couple of old pages on the site.

This page is referenced in: