• 0 Posts
  • 7 Comments
Joined 1 month ago
cake
Cake day: June 12th, 2025

help-circle
  • I have been on Arch , and I’m now running NixOS as my daily driver… IMO NixOS is less of a hassle to set up, and nearly maintenance free compared to Arch… Twice a year when the channel updates there’s a bit of stuff, but every change I need to make is usually explained in the output of my nixos-rebuild… If something suddenly breaks in an update, I just boot into my previous generation, roll back my flake.lock and wait a few days for a fix to be available…




  • Unittest in Python, enjoy! If you pass it with a function like the one in OPs picture, you have earned it.

    import unittest
    import random
    
    class TestOddEven(unittest.TestCase):
        def test_is_odd(self):
            for _ in range(100):
                num = random.randint(-2**63, 2**63 - 1)
    
                odd_num = num | 1
                even_num = num >> 1 << 1
    
                self.assertTrue(is_odd(odd_num))
                self.assertFalse(is_odd(even_num))
    
        def test_is_even(self):
            for _ in range(100):
                num = random.randint(-2**63, 2**63 - 1)
    
                odd_num = num | 1
                even_num = num >> 1 << 1
    
                self.assertTrue(is_even(even_num))
                self.assertFalse(is_even(odd_num))
    
    if __name__ == '__main__':
        unittest.main()