APIs Are a Fair Use

It took just 10 years but we finally know for sure: copying API is a fair use.

There’s a really detailed analysis of Supreme’s court decision at TechDirt for those wanting details.

Despite result matching what I believe is right and better for industry, it’s really heartbreaking it took 10 years and millions in lawyers to clean this up.

Wait For Mountpoint

I have quite a few scripts running on my home server and they love writing on disk. They love it so much that, after reboot, they don’t necessarily wait for mount points to appear - they just start writing. Unfortunately, such eagerness also means that my other scripts mounting ZFS might find directory already in use and give up.

What I needed was a way to check if mount point is already there before starting with write. The easiest approach for me was using mountpoint command.

TEST_PATH=/test/directory
while(true); do  # wait for mount point
    mountpoint "$TEST_PATH" >/dev/null
    if [[ $? != 0 ]]; then
        sleep 1
        continue
    fi
    break
done

Script fragment above will check if given directory has something mounted and, if not, wait for 1 more second. Once test succeeds, it will break out of the infinite loop and proceed with whatever follows.

Easy enough.

Toto Slice

As my son went about cutting a mega bread slice, I told him that was called a “Toto slice”. And then immediately went onto explaining what is the origin of that phrase and why the heck nobody uses it except me.

Well, story starts ages ago when I got my first dog. It was a black terrier and a spitting image of Toto from Wizard of Oz. And Toto slice wasn’t named after him because he didn’t like bread. He liked chickens. Our chickens.

So, within a month, Toto was pronounced incompatible with our yard and gone. Where? I am not sure as some secrets run deep in my family but official version is that he was sold to somebody else. Whether it was an upstate farm or a backyard, the end result was the same - I was dogless.

Some time after, a replacement arrived. It was a mix of a female Scottish shepherd and a male white terrier. Rumors are that conceiving happened due to the bet between owners of each in regards to the capabilities of terrier. If they are true, terrier was skilled enough and thus a few puppies became available soon after.

In any case, the new dog was completely white and would quickly grow close to the size of a (smaller) Scottish shepherd. And his name was Toto too. It was shame to throw away a good name despite this dog being as far as possible from the Wizard of Oz namesake being both white and large.

Life wasn’t always easy and, while my family never went hungry, there was no extra money for dog food. Toto ate what we ate - more precisely, he ate leftovers. When leftovers were sparse, he would get a huge thick slice of bread dipped in the melted lard. That became known in the family as a Toto slice (or “totovska šnita” in my native language).

And Toto slice wasn’t just for a dog. Whenever my sister or I wanted a large piece of (ideally warm) bread, we would use the same phrase. And that’s the phrase I kept using for years and well into my current 40’s.

This phrase might live on with my children along with a story. Or it might die off with me. Regardless, I find it really interesting how sometime words we personally take for granted might not be known even to those closest to us. And how private the language can be even in these global times.

Transparent Mikrotik

Wyze Base Station created an interesting conundrum for my network. Unlike most IoT devices, it requires a cable connection. Place where I wanted to place it didn’t have any. So, the choice was to either bring a new cable or figure some other method. Of course, some other method it is.

As often, my hammer for those situation was Mikrotik device. In this case mAP lite. Idea was to create a transparent bridge (or as close to it as possible) between the Base Station and my network. Ideally, it would even keep MAC address of base station.

This is what I ended up going with:

/interface wireless
set [ find default-name=wlan1 ] ssid=^^SSID^^ mode=station-pseudobridge frequency=auto 

/interface wireless security-profiles
set [ find default=yes ] authentication-types=wpa2-psk wpa2-pre-shared-key=^^key^^

/interface bridge
add name=bridge1 protocol-mode=none

/interface bridge port
add bridge=bridge1 interface=wlan1
add bridge=bridge1 interface=ether1

First step was to switch wireless into station-pseudobridge mode. While it has a lot of warnings (mostly due to L2 bridging being tricky with wireless), it’s actually ideal for this situation as one device it connects to will be the sole user of it.

Once wireless security has been setup, all remaining is to create a bridge with both wireless and wired interface.

And that’s it.

Couldn't Find a Valid ICU Package

As I ran my .NET 5 application on Linux, I was greeted with the following error:

Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_CurrentCulture()
   at System.Globalization.NumberFormatInfo.get_CurrentInfo()
...
Aborted (core dumped)

Underlying cause was my ancient Red Hat installation missing localization support and the easy way to deal with it is was to simply set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT environment variable. On command line that would look something like this:

DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ./myprogram

However, if we really don’t need globalization support, setting it directly in .csproj might be better:

  <PropertyGroup>
    <InvariantGlobalization>true</InvariantGlobalization>
  </PropertyGroup>