Lenovo Flex 5 Wifi card replacement

I had bought a Lenovo Flex 5 a couple of months ago and am running Fedora Linux 33 (and now 34) on it. The factory wifi card (RealTek) on this laptop sucked big time on Linux. The wifi was slow and the connection kept dropping from time to time. I tried a bunch of opensource drivers but without much success. After being frustrated about it for a while I finally ordered an Intel Wifi card from Amazon and replaced the realtek one with it. Wifi is now blazing fast on the laptop without any disconnection issues.

Direct sow

I have add success with sowing the following seeds directly in the ground

  • Gourds (after soaking the seeds for 24 hours)
  • Okra
  • Leafy veggies such as Kale (mid march), Arugula, Collards, Mustard etc
  • Cilantro (after crushing the seeds into two)

No seedlings next year

Most of my seedlings (except peppers and tomatoes) have died out by now due to over exposure to sun. I won’t be growing any seedlings next year. The important learning with seedlings is that seedlings need to be gradually exposed to the sun. They need to be first exposed indirectly to the sunlight for a week and then couple of hours directly for a week or two before moving them out in full direct sun.

It’s much easier and cheaper to just buy seedlings from Raleigh’s farmer’s market. For gourd seeds will buy them from Etsy, have found a good vendor TommorrowSeeds there.

Dead gourds

Looks like all of my gourd seedlings died because of over exposure to sun. Next year will remember to plant the gourd seeds directly instead of growing seedlings. Also another important lesson about planting gourd seeds is to soak them in water for 24 hours before planting them into the soil.

Farming 2021

Vegetable beds

Built some vegetable beds this year as there wasn’t much else to do because of covid. Planning on becoming a weekend farmer this year.

I tried growing seedlings (indoors) for some herbs, peppers, tomatoes, eggplants, bitter gourd, bottle gourd. The important lessons learnt this year are

  • Start the seedling process in end of Feb or 1st week of March
  • Grow seedlings indoors for peppers and all of the gourds. Everything else is pain and did not survive.
  • It’s much cheaper to buy seedlings for all of the herbs, tomatoes, eggplants from the farmer’s market in the last two weeks of April and probably first week of May.

The only thing left for me to plan now is collards, lettuce, beans and okra. Will probably get them planted tomorrow.

Building an interpreter in RUST

Just finished going through “Writing An Interpreter In Go“. However instead of implementing the interpreter in Go, I decided to implement it in RUST. This was one of the most satisfying software projects that I worked on in a while. I must say that I just love RUST as a systems programming language.

The important RUST features that I used to get this project done are

  • Enums as data types
  • Box
  • Rc
  • RefCell
  • Lots of recursion

RUST enables you to write the code in a declarative manner which makes the code really compact and easy to understand

OpenDNS

Cisco has a great product called OpenDNS that enables you to control the websites that can be reached from home your network. If you have Google wifi at home, you can use OpenDNS to block gaming websites like Roblox.

Wireless issues on Lenovo Flex running FC 33

I purchased a Lenovo Flex couple of months ago and installed Fedora 33 on it. Was really frustrated with the wifi on the laptop. The realtek wireless drivers merged in the official kernel suck big time.

Trying out a solution, hope will work (and it did not)

sudo nmcli con reload wlp2s0

The above command to restart the wireless seems to have helped. Also following are the wireless kernel modules that are currently loaded

lsmod | grep rt
rtl88x2ce            3018752  0
rtw_8822ce             16384  0
rtw_8822c             471040  1 rtw_8822ce
rtw_pci                28672  1 rtw_8822ce
rtw_core              212992  2 rtw_8822c,rtw_pci
mac80211             1081344  2 rtw_core,rtw_pci

Shifted binary search

 
public static int shiftedBinarySearch(int[] array, int target) {
    return shiftedSearch(array, 0, array.length - 1, target);
}

public static int binarySearch(int[] array, int startIdx, int endIdx, int target) {
        int midIdx = (startIdx + endIdx) / 2;

        if (startIdx > endIdx || endIdx >= array.length) {
            return -1;
        }

        if (startIdx == endIdx) {
            if (array[midIdx] == target) {
                return midIdx;
            } else {
                return -1;
            }
        }

        int result = -1;
        if (target <= array[midIdx]) {
            result = binarySearch(array, startIdx, midIdx, target);
        } else {
            result = binarySearch(array, midIdx + 1, endIdx, target);
        }

        return result;
    }

    public static int shiftedSearch(int[] array, int startIdx, int endIdx, int target) {

        if (startIdx > endIdx || endIdx >= array.length) {
            return -1;
        }

        if (array[startIdx] == target) {
            return startIdx;
        }

        if (array[endIdx] == target) {
            return endIdx;
        }

        int result = -1;
        int midIdx = (startIdx + endIdx) / 2;


        if (array[startIdx] > array[midIdx]) {
            result = shiftedSearch(array, startIdx, midIdx, target);
            if (result != -1) {
                return result;
            }
        }

        if (array[midIdx + 1] < array[endIdx]) {
            result = binarySearch(array, midIdx + 1, endIdx, target);
            if (result != -1) {
                return result;
            }
        }


        if (array[startIdx] < array[midIdx]) {
            result = binarySearch(array, startIdx, midIdx, target);
            if (result != -1) {
                return result;
            }
        }


        if (array[endIdx] < array[midIdx + 1]) {
            result = shiftedSearch(array, midIdx + 1, endIdx, target);
            if (result != -1) {
                return result;
            }
        }
        return result;
    }