Thoughts and Ramblings

General things I find of interest.

WSL2 Start on Boot

In setting up SSH into an Linux install in WSL2, I’ve found guides on how to do this setup. While most contain the similar steps for setting up SSH, they have very different mechanisms for making it start on boot, of which almost none work.

Setting up SSH

First I’ll assume you are running WSL2 and have installed a debian based linux within it.

  1. Launch the WSL instance and inside it execute:
    sudo apt install openssh-server
    
  2. Run ip addr show to get the IP address of this VM to be used later
  3. Launch your favorite shell on the windows side and run:
    netsh advfirewall firewall add rule name=”Open Port 2222 for WSL2” dir=in action=allow protocol=TCP localport=2222
    netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=2222 connectaddress=172.23.129.80 connectport=22
    
    and substitute the IP address you obtained earlier for the connectaddress in the second line.
  4. Execute netsh interface portproxy show v4tov4 to confirm it is set correctly (and you can run netsh int portproxy reset all to remove the entries if you need).

(A step or two may be missing above but this is the gist and I’m not trying to make a comprehensive guide for this part)


Nix on Mac

A couple of months ago, I started using Nix on the Mac instead of homebrew. This included setting up home-manager and nix-darwin. There are a lot of setup guides on these and I’m not going to repeat that work. I will mention some pieces that I found particularly annoying and their solutions.

Multiple Repositories

Nix allows you to specify multiple repositories where it can fetch code. However, getting this to work with home-manager can be annoyingly difficult to figure out, especially if you use a flake with multiple files like myself. This is how I got it to work:


Our Bureaucracy

In one of my previous posts, I talked about the phrase our democracy and how those using the phrase do not intend the word our to include the general public. However, in the past few weeks I saw on X that this is far better described by substituting the word bureaucracy for the word democracy (as reiterated by this tweet by Elon Musk).

So there you go: Trump is a threat to our bureaucracy. It’s true and that exactly why people elected him. The people want a threat to the bureaucracy to bring it to heel. The mainstream (lamestream to many of us former listeners) press tried to tell us all along but they just couldn’t get it quite right. Perhaps they believed that if they did, even more would vote for Trump?


Badblocks

I was looking into mechanisms to test out new hard drives and ran across the program badblocks which can perform such testing and even a script which wraps this. Though it seems that badblocks has an issue with the block count being only a 32-bit integer so if you want to perform the test on a drive bigger than 16TB, you need to use a block size of 8192 or larger. In further examination of the documentation, I saw there is an option about the number of blocks which are tested at a time and this value defaults to 64. I searched to see if increasing this value can have a speed impact and many commented that doesn’t seem to have any effect.


Only Tax Payers Vote

In “Starship Troopers” Heinlein proposed the idea that only citizens can vote and only those who served in the military can become citizens (no inheritance of citizenship). The idea is interesting in that voting is limited to only those with skin in the game (military service). While I read the novel many years ago, recently I considered an similar interesting thought experiment:

What if only tax payers can vote? Here, by “tax payers” I mean those who net pay money to the government. So if someone receives $4k from the government but pay only $3k in taxes, this person doesn’t qualify. But if this same person paid $5k in taxes, then they would. How would the US be different if this were the case?