Skip to content

50th Week of 2022




  • Correction: Use decrypt_file instead of decrypt for files.


    Note: You can't pass Path arguments to decrypt_file.

Python Snippets

  • New: Print an exception using the logging module.

    Logging an exception can be done with the module-level function logging.exception() like so:

    import logging
        1 / 0
    except BaseException:
        logging.exception("An exception was thrown!")
    ERROR:root:An exception was thrown!
    Traceback (most recent call last):
    File ".../Desktop/", line 4, in <module>
    ZeroDivisionError: division by zero


    • The function logging.exception() should only be called from an exception handler.

    • The logging module should not be used inside a logging handler to avoid a RecursionError.

    It's also possible to log the exception with another log level but still show the exception details by using the keyword argument exc_info=True, like so:

    logging.critical("An exception was thrown!", exc_info=True)
    logging.error("An exception was thrown!", exc_info=True)
    logging.warning("An exception was thrown!", exc_info=True)"An exception was thrown!", exc_info=True)
    logging.debug("An exception was thrown!", exc_info=True)
    logging.log(level, "An exception was thrown!", exc_info=True)
  • New: Print an exception with the traceback module.

    The traceback module provides methods for formatting and printing exceptions and their tracebacks, e.g. this would print exception like the default handler does:

    import traceback
        1 / 0
    except Exception:
    Traceback (most recent call last):
      File "C:\scripts\", line 4, in <module>
    ZeroDivisionError: division by zero




  • New: Installation tips for CPU.

    When installing an AM4 CPU in the motherboard, rotate the CPU so that the small arrow on one of the corners of the chip matches the arrow on the corner of the motherboard socket.

Operating Systems



  • New: Installation.

    I was not able to follow the web instructions so I had to follow the cli ones.

    Whenever I run a fastboot command it got stuck in < waiting for devices >, so I added the next rules on the udev configuration at /etc/udev/rules.d/51-android.rules

    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0600", OWNER="myuser"

    The idProduct and idVendor were deduced from lsusb. Then after a restart everything worked fine.



Forking this garden

  • Correction: Update forking instructions.

    I recommend against forking the repository via Github. If you do that, you'll have all the history of my repository, which will make your repository more heavy than it should (as I have a lot of images), and it will make it hard for me to make pull requests to your digital garden.

    Furthermore, you'll always see a message in your repo similar to This branch is 909 commits ahead, 1030 commits behind lyz-code:master. like you can see in this fork. Also if you don't want to keep all the content I've made so far and want to start from scratch then the only thing that is useful for you is the skeleton I've made, and I don't need any attribution or credit for that :P.

    If on the other hand you do want to keep all my content, then wouldn't it be better to just make contributions to this repository instead?

    Therefore the best way to give credit and attribution is by building your garden (the more we are writing the merrier :) ), and then if you want to spread the word that my garden exists within your content then that would be awesome.

    If you end up building your own, remember to add yourself to the digital garden's list.