Quick sort in Python

Quick sort in Python

A milltion times already on the internet and sorting methods already integrated in the language – so why?Because written things stay better in the brain and I like to understand things from the ground. ArjanCodes (I love your content!) recently posted a video about recursive functions and used a similar code. I won’t have written…

Is it a bird? Is it a plane? Nah – just a Python class behaving like a dictionary.
|

Is it a bird? Is it a plane? Nah – just a Python class behaving like a dictionary.

For a container class with a dictionary with config values (among other members) I wanted easy reading access as if it was a dict itself. For that you only have to implement the __getitem__ method. You can extend the provided dict functionality for your class if needed like the following: All but the update method…

I am here. Definitively NOT sleeping or sunbathing – A configurable anti-AFK Python script with pyautogui

I am here. Definitively NOT sleeping or sunbathing – A configurable anti-AFK Python script with pyautogui

Yeah I know it’s kinda pointless. I was thinking the same thing when I doomscrolled youtube shorts watching a so called programmer “Herr Programmierer” showing a simple script moving the mouse in a fixed interval to coordinates in a fixed square. I was bored, I like Python and sure I could create a better pointless…

Finding Nemo or check a Python list if there is one or all elements matching a condition
|

Finding Nemo or check a Python list if there is one or all elements matching a condition

Yeah we all can loop, but can you any or all? Checking if condition matches for at least one element of an iterable (e.g. list, tuple, set) In Python you can write that nicer with the builtin method any(): But who doesn’t like a one-liner (that is understandable): Very similar is the case if you…

Mastering the chaos – subscribe to all MQTT topics of your Mosqitto server with console and Node-RED

Mastering the chaos – subscribe to all MQTT topics of your Mosqitto server with console and Node-RED

I wanted to know which topics are active on my MQTT server and if there were some skeletons in the closet I could get rid of. Many Iot devices, Node-RED flows and surely some unused topics or old retained topics lead to more or less MQTT being a chaotic museum of topics. This is just…

You are locked in here with me(dia) – function keys always on. How to deactivate?

You are locked in here with me(dia) – function keys always on. How to deactivate?

Pressing F5 does not refresh your view anymore but rewinds the current media?F11 does not run the selected JUnit test in Eclipse any more but activates Caps Lock? I have a Logitech K850 keyboard and I unintentionally turned on the function key lock (didn’t even know such a thing existed). Try the following: [Fn] +…

Always look on the bright side of life: An adaptive night light for RGB LED stripes in MicroPython
|

Always look on the bright side of life: An adaptive night light for RGB LED stripes in MicroPython

This covers a very configurable and more complex variant of measuring brightness and turning on LEDs.If you are looking for a more basic variant: It all began with a LDR and curiosity. The result is a night light for a ESP8266 like D1 Mini or Raspberry Pi Pico (W) which compensates darkness with many configurable…

How not to make your config file a pain in the ass – MicroPython edition

How not to make your config file a pain in the ass – MicroPython edition

Externalizing the configuration is a good idea. This makes the reusability of your program much higher and a user doesn’t have (and shouldn’t have to) change values in the code.This separation tends to show where your code is perhaps too tightly coupled and constants are referenced directly as they are directly available in the script…

Is it dark yet ? – Measuring brightness with LDR on Pi Pico (W) and ESP8266 (D1 Mini & NodeMCU v3) in MicroPython

Is it dark yet ? – Measuring brightness with LDR on Pi Pico (W) and ESP8266 (D1 Mini & NodeMCU v3) in MicroPython

Materials you need for this: LDRs (I am using 5528), breadboard, jumper wires, resistor (I used 56k) and a 5V power supply. The MicroPython code has been written for and tested on Pi Pico, Pi Pico W, D1 Mini and NodeMCU v3 ESP8266 .I bought it at berrybase.de and az-delivery.de (not referral links). The microcontrollers…