20241114 ◎

WSL

People (around me) were talking about WSL, but I had no idea.

What is Windows Subsystem for Linux?

Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows machine, without the need for a separate virtual machine or dual booting. WSL is designed to provide a seamless and productive experience for developers who want to use both Windows and Linux at the same time. - Use WSL to install and run various Linux distributions, such as Ubuntu, Debian, Kali, and more. - Store files in an isolated Linux file system, specific to the installed distribution. - Run command-line tools, such as BASH. - …

What is WSL 2?

WSL 2 is the default distro type when installing a Linux distribution. WSL 2 uses virtualization technology to run a Linux kernel inside of a lightweight utility virtual machine (VM). Linux distributions run as isolated containers inside of the WSL 2 managed VM.

So, basically, WSL is a feature of Windows that allows Linux to run in a virtual environment (machine) conveniently.

I haven’t used Windows in the last 10 years or more, especialy not for work, so I haven’t come across WSL in my life.

Move between spaces (MacBook)

My friend taught me about this feature when I was a sophomore, and since then, the MacBook spaces have been one of my faborite features.

Work in multiple spaces on Mac - Apple Support

Move between spaces - Press the Control key and the Right or Left arrow key.

Apple’s trackpad is super convenient, and shortcuts are not portable knowledge, so I usually don’t remember shortcuts, but this one seems to be useful.

Radix Sort (String)

import string


def radix_sort(arr: list[str]) -> list[str]:
    # n = len(arr), d = max length of input strings

    chars = "@" + string.ascii_lowercase

    # padding
    # O(nd)
    max_len: int = max([len(s) for s in arr])
    for i in range(len(arr)):
        arr[i] = arr[i] + "@" * (max_len - len(arr[i]))

    # counting sort
    # O(nd)
    for i in range(1, max_len + 1):
        bucket = []
        for j in range(len(chars)):
            bucket.append([])

        for s in arr:
            bucket[chars.find(s[-i])].append(s)
        tmp = []
        for i in range(len(chars)):
            tmp.extend(bucket[i])
        arr = tmp

    # remove padding
    # O(nd)
    for i in range(len(arr)):
        arr[i] = arr[i].replace("@", "")

    return arr


arr: list[str] = ["abc", "cca", "efg", "oie", "oac", "aa", "c"]
print(f"{arr=}")
print(f"{radix_sort(arr)=}")  # ['aa', 'abc', 'c', 'cca', 'efg', 'oac', 'oie']

I didn’t refer to any resources, so I wouldn’t say that the code is optimal/clean.

Same as the radix sort for integers, we just need to repeat running counting sort for the number of maximum length.

The only difference is the bucket size: when dealing with decimal numbers, we only need a bucket with a length of 10, but we need a bucket with a length of 26 (+1) to deal with lowercase alphabets.


158.6 lb (The scale’s behavior is unstable. I’m considering buying a new one)

Berries 300 Protein shake 300 Oatmeals 450 Salad 300 Mac&cheese 400 Kombucha 50

Total 1800 kcal


MUST:

TODO:


index 20241113 20241115