Python: How to reduce memory usage

Useful information for reducing memory usage of Python programs:


TLDR: Dictionaries use a lot of memory. Possible solutions include using a class and slots, namedtuple, recordclass, cython, or numpy.

Screen brightness: Linux + Lenovo P50

I run Ubuntu on my Lenovo P50, and the backlight keys haven’t ever worked. Here’s how I got it working.

sudo apt install xbacklight

Then I mapped the keys using Settings > Devices > Keyboard and added mappings for the following:

Windows-F5: xbacklight -inc 5 -time 1 -steps 1
Windows-F6: xbacklight -dec 5 -time 0 -steps 1