Notes for May 27-June 2

It’s definitely getting summery, and this week marks the first time I turned on the office AC this year1. Other than that, a couple of bank holidays (in the US and here) made for a slower week than usual, which I have been taking advantage of to make my life somewhat more orderly.

Foam, My Killer

I have been trying to use for ages now, but it’s always felt unwieldy and broken, and none of the “one app to note it all” approaches sits well with me, so I decided to go down the editor enhancement route and started using Foam.

Foam is a extension that got three of my key requirements just right:

  • It was able to open this site’s (mostly ) source tree–around 10000 items, not all of which are public–and not crash
  • It was also able to use the vast majority of the front matter metadata with zero tweaks and enable me to navigate the site by tag, which is going to help a bit with consistency.
  • It focuses on the essentials for jotting down and relating ideas while leveraging everything else I already have in my editor.

I’m now using it to manage my Drafts namespace (which is a sort of “limbo” folder for drafts that I’m not actively working on in iA Writer), my home documentation (which I’m maintaining in mkdocs-material and a few other things, and the fact that I added each of those progressively over a few weeks tells me it’s working for me.

And since my writing workflow typically begins in and ends in with a long chunk of revising and focused editing in iA Writer, adding Foam at both stages makes a lot of sense.

Cleaning Up Self-Hosted AI

This was a cleanup/consolidation week for more things than notes–I also did a bit of infrastructure cleanup and moved a few of my support containers to other machines.

This because my workflow, other than SBC tests, can now be clearly split into three kinds of resources:

  • Sandboxes (Node-RED and Jupyter)
  • Stable tools (Open Web UI plus a few AI workflows implemented in Piku)
  • Model hosting (I have the and both acting as GPU servers, but I only really need one)

I also spent a little while playing with ChatTTS and got it to run on Metal. CPU generation was still much faster, but I blame that on my lack of familiarity with mps and the relatively newness of the code.

SpaceMousing

My replacement with Bluetooth arrived, so I spent some time looking at SpaceMouse in and and did the following.

This led to my filing #5153, PR #5155 and PR #103 across and the spacenavd library both it and are using.

Sadly the implementation is just… bad, so I either have to wait until someone sorts it out to match ’s or add yet another Summer project to my list.

I also got in a couple of new magnetometer/accelerometer boards I had ordered weeks ago, so I might have another go at implementing mine…

Keyboarding

I found a battery replacement for the early review unit I was sent, and it was a trivial thing to unscrew the lid, pop it out and access the battery:

iFixit would probably give this a 9/10, but only because the adhesive under the battery is quite stubborn.

The original battery was stamped 3045130 3.7V 2000mAh and the replacement reads 3543114 3.7V 2300mAh, so this was also sort of an upgrade–but I searched for a compatible form factor rather than extra capacity, and I’ll take the extra as a bonus.

So far it’s only charged once and slowly decreased to 85% charge with half a week’s use, which is similar to the replacement unit I got and good news altogether.


  1. After of fiddling with my heat pumps, I’m happy to report that mel-ac-homekit has been working reliably for the past six months, and I might even install a couple more controllers on the devices we had ↩︎

The TP-Link L-SG108E

It’s been a while since I wrote about networking gear, largely because I used to spend a good while working on it and that broke my . But home networking being what it is these days, I thought it would be a nice change from my usual fare.

So here’s a quick write-up on the TP-Link L-SG108E gigabit switches I’ve been using for a while now, in the spirit of an ode to the unseen, unheard, unnoticed and unsung heroes of my home network.

The TP-Link L-SG108E
The TP-Link L-SG108E

Note: This is not a , since I bought these with my own money and have been using them for a while. Like with the , I’m writing this because I’m about to replace them with something else, and I thought it would be nice to write about them before they go.

Our Home Network Situation

The Goldilocks Zone for home networking is when all your machines and appliances have great Wi-Fi coverage from a single piece of equipment–or two. And that is what ISPs normally aim for with integrated home gateway/Wi-Fi routers, because most people will be OK with the fiber or DSL connection to be run to a place near their TV (which is where they tend to use their laptops anyway).

In the US, things are even easier because many houses have wooden structures and (ideally) sit somewhat apart, so you can pretty much wing it as far as Wi-Fi coverage is concerned. We’re not far from the days when, thanks to the higher regulated EIRP back in the 802.11b days, you could use a coat hanger and have perfect Wi-Fi signal.

However, things aren’t that simple when, like me, you live in Europe and in a converted flat that is roughly U-shaped, has reinforced concrete walls and wraps around a lift well (or two).

We also don’t have any easy way to route fiber anywhere from the telco box. Vodafone has a Smart Router with a built-in ONT that provides 1Gb/200Mbps to our home, but it has to be mounted in the utility closet and thus has the effective Wi-Fi reach of a beached porpoise (also, telcos tend to have funny ideas about managing your Wi-Fi for you, so mine has its Wi-Fi turned off).

But we have plenty of copper running in the walls–around 25 years ago, as we moved in and tore up everything to run new wiring, I had the foresight of bringing in a spool of honest-to-goodness Lucent Cat 5 cabling and put two jacks in every room, and that was repeated a few years later when we moved some walls around.

And since most of the runs are way shorter than the 100m limit (the flat is weirdly shaped, but not that big), I’ve been able to get away with using that cable for a long time (and have tested 2.5Gb over some of it, so I know it’s good for a while longer).

Radio and… Backhaul

Yeah, I still think as though I was building mobile networks. Which is good, because our home LAN topology is… complicated, and decent Wi-Fi coverage requires no less than five [Airport Extreme] base stations, all of which are plugged into Gigabit Ethernet.

We have cabling running to several places around the house, some of which have require multiple ports (like the living room, the server closet, and my office), but the resulting topology is not the kind of prototypical star topology I used to design when I put aside that cable spool1.

Wi-Fi was initially provided by two modded on each side of the lift well, but over the years I have progressively upgraded and added to it as we needed better coverage and moved to the 5GHz band (which doesn’t really get past more than one wall)2.

But all of it (except for a couple of boutique switches that I use for PoE testing and some higher speed ports) has been connected via TP-Link L-SG108E gigabit switches, and since that’s about to change, I thought I’d write up how they’ve fared so far, since they are (now) dirt cheap and, despite being “unmanaged” in the enterprise way, actually have some management capabilities that I’ve used with decent success.

The Hardware

The TP-Link L-SG108E is a plain (i.e., discreet), run of the mill switch. It has eight Gigabit Ethernet ports, a power port, a tiny reset button, and a few distinguishing features that caught my eye at the time:

  • 8 10/100/1000 Mbps GbE ports
  • Up to 32 VLANs
  • Per port rate limiting and storm control
  • Static Link Aggregation
  • IGMP snooping
  • Port mirroring
  • Basic loop prevention

It also supports jumbo frames up to 16KB and has a 16 Gbps switching capacity, but those weren’t top of mind when I got it (and I’ve yet to fiddle with jumbo frames, since I don’t have a pressing need for them).

Why I… Switched

I was using unmanaged TP-Link switches for a while, and they were fine–but I wanted to try out a managed switch for a few reasons:

  • Stability: Given the way our flat was wired up, my network topology is anything but “normal” (again, it’s not really a nice, plain star topology), and even though I have managed to (for instance) provide end-to-end dedicated cable paths between Vodafone’s home gateway to things like set-top-boxes (to essentially get them off my network), I still had issues with IGMP and multicast traffic from IoT devices–including the occasional broadcast storm.
  • Traffic Segregation: I wanted to separate my IoT devices and a couple of servers from the rest of my network, and the easiest way to do that is to put them on a separate VLAN. I still can’t get the IoT stuff off the network entirely because the Airport Extremes don’t support VLANs, but my machines are using multiple VLANs (with a tiny VM acting as a router).
  • Link Aggregation: My has dual Gigabit Ethernet interfaces and it supports link aggregation, so I’ve already tested that–the current disks it has are not particularly fast, but backups were much faster, and SMB traffic from my Macs benefited as well.

I’ve reverted it back because I needed to use one of the interfaces for kickstarting a local backup to its predecessor, but I’m planning on setting it up again after the next round of upgrades.

Management

Like I said at the beginning, for a technically “unmanaged” switch the TP-Link L-SG108E has a lot of features, all of which are accessible through a simple, pragmatic web interface:

My office switch, which currently doesn't have a lot of configuration done--but yes, I have that many active ports under my desk...

The first thing I did on all of them was to set up storm protection on the designated “uplink” port, and setting up a few separate VLANs for inter-host chatter across two of them, as well as link aggregation on the one in my server closet.

Monitoring

There isn’t really a lot in terms of monitoring other than packet and line error counters, but what there is has already been useful in identifying misbehaving devices (like oddball Realtek NICs). I do like that it has IGMP spoofing and can list multicast groups in use (since I’ve used multicast for my own monitoring for ages).

What I love, however, is that it has port mirroring. I do occasionally need to sniff traffic from devices to figure out what they’re doing, so that’s already been handy a few times–of course I can only do it on the same switch, but more the reason to have a surplus of ports.

Physical Layer Testing

Another thing I like about the TP-Link L-SG108E is that it has cable fault detection–I have a cable tester, but when moving things around and reaching into my box of cables to re-patch things I sometimes get either a dud jack (caught one a year ago that was good enough for Fast Ethernet, but had a broken wire for GigE) or a dud cable.

And, sometimes infuriatingly, an intermittent contact, like what you’d get if the cable was physically stressed. Believe me, it helps knowing which cable is “bad” before you start moving heavy furniture around.

VLANs and Flow/Storm Control

I’ve had zero issues setting up 802.1Q on my servers and the TP-Link L-SG108E, or propagating those to another switch. The only issue I had that I can remember was an mis-configuration on my old KVM host (that replaced, and provided a nice GUI on top).

I haven’t used the bandwidth “control” feature at all, but the storm control (together with the IGMP snooping) allowed me to limit the damage a buggy IP camera caused sometimes, and what I do is rate limit multicast and broadcast traffic to a point where it’s unlikely to cause damage.

Conclusion

In terms of time saved alone, the three TP-Link L-SG108E I’ve been using (along with their PoE and smaller cousins, which I may write about some day) pretty much paid for themselves even at the EUR 70 price point they originally had (they are now around half that).

They’ve been utterly reliable, quiet, fairly low power and run perfectly cool, so I have no trouble recommending them if you’re either still stuck in the Fast Ethernet age (which is still a reality for most people), or if you need a little more control over your wired network but can’t justify moving to 2.5Gb and beyond.

Like I hinted at in the beginning, the reason I’m writing this is that I will be replacing (some) of them with upgraded gear (which I need now that I have an electronics/hardware test bench and consulting on some industrial projects).

I also want to begin putting in place the right infrastructure to do things like video editing directly on my NAS, which really needs a lot more end-to-end throughput…

That will eventually lead to laying down the foundation for upgrading my Wi-Fi network next year, so… watch this space. There will be more about networking, and likely not all of it about my home.


  1. The company I worked for, Sol-S, was a retailer and is long gone, but we wired up all the Post Office buildings in Lisbon at that time, and I probably still have the spreadsheets someplace on a floppy disk… ↩︎

  2. Plus most of our neighbors’ access points seem to be stuck at their ISP’s defaults (typically channels 1 or 6 in the 2.4GHz band). It feels weird to have to do radio planning at home, but such is life. ↩︎

Notes for May 20-26

This week I spent a fair bit of time watching Microsoft Build recordings–partly because it has some impact on , and partly because it was brimming with stuff I can actually use.

And yes, you need to cherrypick. Here’s a few I am taking as inspiration:

The no-code stuff was also pretty impressive, but I can’t really use it in my own projects…

Prompting Phi-3 Successfully

I finally had some success at getting phi3:instruct to do function calling with ollama, which is great because it can be so much faster than llama3 on restricted hardware.

The system prompt structure I arrived at for moderately effective RAG is rather convoluted, though, and I had to cobble it together from various sources:

You are an AI assistant that can help the user with a variety of tasks. You have access to the functions provided by the schema below:

<|functions_schema|>
[
    {
        "name": "duckduckgo",
        "description": "searches the Internet",
        "parameters": [
            "name": "q"
            "type": "string"
        ],
        "required": [ "q" ],
        "returns": [
            {
                "name": "results",
                "type": "list[string]",
            }
        ]
    }
] 
<|end_functions_schema|>

When the user asks you a question, if you need to use functions, provide ONLY ALL OF THE function calls, ALL IN ONE PLACE, in the format:

<|function_calls|>
[
    { "name": "function_name", "kwargs": {"kwarg_1": "value_1", "kwarg_2": "value_2"}, "returns": ["output_1"]},
    { "name": "other_function_name", "kwargs": { "kwarg_3": "$output_1$"}, "returns": ["output_2", "output_3"]},
    ...
]
<|end_function_calls|>

IF AND ONLY IF you don't need to use functions, give your answer in between <|answer|> and <|end_answer|> blocks. For your thoughts and reasoning behind using or not using functions, place ALL OF THEM in between a SINGLE <|thoughts|> and <|end_thoughts|> block, before the <|function_calls|> and <|end_function_calls|> tags, like so:

<|thoughts|>
The user wants X, to do that, I should call the following functions:
1. function_name: Reasoning,
2. function_name_2: Reasoning2,
3. etc.
<|end_thoughts|>

Provide nothing else than the information in the <|function_calls|> & <|end_function_calls|>, <|answer|> & <|end_answer|> and <|thoughts|> & <|end_thoughts|> blocks.

phi3 still hallucinates every now and then, but the block approach made it easier to parse the outputs, and chaining function calls using contexts is relatively easy.

Still, I keep looking for ways to make prompt generation, function chaining and general workflows simpler, especially because this doesn’t really let me restrict outputs to a predefined set of options and other things that improve reliability when chaining actions.

Guidance

My prompting woes… prompted me (ahem) to take another look at guidance, which promises to solve a lot of those issues.

However, as it turns out I can’t really use it for my edge/ARM scenarios yet–this because ollama support is pretty much half-baked (in all fairness, guidance tries to do token manipulation directly, so it really relies on direct access to the model, not APIs).

But it is interesting for doing general purpose development, even with local models–there just isn’t really a lot of usable documentation, so it took me a bit to get it to work with Metal on macOS.

Here’s all you need to know, using their minimal sample:

from guidance import gen, select
from guidance.models import Transformers
from torch.backends import mps
from os import environ

MODEL_NAME = environ.get("MODEL_NAME", "microsoft/Phi-3-mini-4k-instruct")

device_map = None
if mps.is_available():
    device_map = "mps"

phi3 = Transformers(MODEL_NAME, device_map=device_map)

# capture our selection under the name 'answer'
lm = phi3 + f"Do you want a joke or a poem? A {select(['joke', 'poem'], name='answer')}.\n"

# make a choice based on the model's previous selection
if lm["answer"] == "joke":
    lm += f"Here is a one-line joke about cats: " + gen('output', stop='\n')
else:
    lm += f"Here is a one-line poem about dogs: " + gen('output', stop='\n')

And this is the minimal set of packages I needed to install to have a usable sandbox:

guidance==0.1.15
transformers==4.41.1
sentencepiece==0.2.0
torch==2.3.0
torchvision==0.18.0
accelerate==0.30.1
#litellm
#jupyter
#ipywidgets

I also had another go at using promptflow, but it too is tricky to use with local models.

But I have more fundamental things to solve–for instance, I’m still missing a decent in-process vector database for constrained environments. Can’t wait for sqlite-vec to ship.

The Keychron K11 Max

A few weeks after I posted my , Keychron reached out to ask if I wanted to try out the K11 Max, a compact Alice layout keyboard–and I ended up saying yes.

Read More...

Notes for May 13-19

This was a moderately intense week work-wise, but I had a few hours in the evenings to continue my tests of RK3588 boards and, of course, fiddle with ’s API.

Read More...

The SpaceMouse Wireless

This is a tale of ancient wizardry, yearning for control, failed prototypes, and just plain bad timing. Let us begin.

Read More...

Notes for May 6-12

Thanks to the lethargy brought upon by allergies and the beginning of the warm season, this was a week where most of my free time was spent fixing things and building tools.

Read More...

Notes for April 29-May 5

Following up on my , I upgraded my ’s firmware to the latest iteration, which didn’t really fix its display (it now displays thumbnails, but all the responsiveness bugs I mentioned in my are still there).

Read More...

NC Editor, an (iPad) Patch Editor for the Circuit Tracks

A couple of months ago, Deepsounds reached out to ask if I could have a look at their patch editor, to which I enthusiastically agreed since I was actually in the process of to my and designing printable DIN to TRS adapters so I could use both together.

Read More...

The Big Blue Room

Sometimes I leave the house and go to exciting places, meet great people… and have lunch with them.

Plug-and-Play KlipperScreen for the TwoTrees SK1

Like I wrote on , the comes with a somewhat serviceable, but quite buggy screen that uses the Nexion UI toolkit. At the time I was already able to use CYD-Klipper to have a remote display, but I’ve been investigating ways to get KlipperScreen working, and finally set up a single-cable, plug-and-play solution:

Read More...

Notes on LLM GUIs

This week’s notes come a little earlier, partly because of an upcoming long weekend and partly because I’ve been mulling the LLM space again due to the close release of both llama3 and phi-3.

Read More...

Notes for April 15-21

I ended up throwing my back out on early in the week, so most of my time was spent in comical pain, moving around like a crab on stilts and trying to get some work done in between bouts of lying down, watching Fallout and reading Scalzi’s Starter Villain, which was actually quite fun.

Read More...

The BSP D8 Bluetooth Game Controller

Since it seems to be , I thought I’d rewind back to my , when as a concession to the need to relax I decided to pack some form of gaming device. But since I also wanted to minimize packing, I settled on a game controller and using my iPad Pro for light gaming.

Read More...

Archives3D Site Map