Self contained Django, or Django like Flask

Posted on czw 14 maja 2020 in misc • Tagged with tipsNtricks, django, flask, pytest

Have you thought about spawning Django as easy as Flask?

Imagine that you have a library, which may have a feature that is usable in Django. How to test it?

99% of you would say - make a Django project, put test inside the project, and run django test.

I thought …


Continue reading

My new ESP32 is bricked?

Posted on śro 17 kwietnia 2019 in micropython • Tagged with IoT, micropython, python, tipsNtricks

TL;DR: press 'boot' button when flashing ESP32. At least some of them.

I have connected newly bought ESP32 to usb cable and try to flash it with micropython image.

(micro) maho@dlaptop:~$ esptool.py --port=/dev/ttyUSB0 erase_flash
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting........_____....._____ …

Continue reading

Effective hg blame in VIM

Posted on nie 15 lipca 2018 in misc • Tagged with tipsNtricks, hg, vim

If you want to open tab in vim, which shows you file history, file blame (who changed what) and patch history, here is easy command:

    :let fname=expand("%") | tabnew | execute 'read!hg blame '.fname | vnew | execute 'read!hg glog '.fname | new | execute 'read!hg glog -p '.fname

Queryset repr trick

Posted on czw 15 lutego 2018 in misc • Tagged with tipsNtricks, python

Sometimes, when I'm debugging something using pudb (probably it affects any interactive debugger), pudb is reflecting value of variables of QuerySet type, which makes unneccesary query to database. It makes debugging slow, and sometimes it breaks debugging context because of making changes in db.

To avoid that, add following code …


Continue reading