Juggling with (your) balls – Quick sort in Python

Juggling with (your) balls – 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…

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…

Trust is good control is better – JUnit Tests (parametrized and different arguments providers) with RxJava and some Mockito

Trust is good control is better – JUnit Tests (parametrized and different arguments providers) with RxJava and some Mockito

A follow up to Software tests – some basic JUnit testing in the area of RxJava. Not much text right now, just the announcement, the code below and the link to my github repo. Includes a build.gradle with all the needed dependencies.(There are already some other test concerning ConnectableObservables subscriptions and time of emit.) Short…

Deciphering the expected secret – Python this.s in a one liner

Deciphering the expected secret – Python this.s in a one liner

The little easter egg of “import this” in Python is well known – it shows Zen of Python. Nice guideline of how to keep your code clean. The Zen of Python, by Tim Peters Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse…

Where are they going? – int angle to direction mapping in Python

Where are they going? – int angle to direction mapping in Python

A little util to map direction angle from weather API to ‘NW’ (SHORT, default) or ‘north west’ (LONG). Supports english (default) and german. An example API call to the weather API I am using and mapping the current wind direction to readable format. All my weather related code at github https://github.com/worksonmymachine-de/weather.

It’s raining codes and docs. WMO weather interpretation code mapping and translation for english and german

It’s raining codes and docs. WMO weather interpretation code mapping and translation for english and german

Just wanted to let you know I wrote a little mapper / translation for WMO weather codes as the (free) API I use for current weather and forecast also provides it. An example API call to the weather API I am using and mapping the current weather code to readable format. The code is on…