Skip to content

works on my machine

¯\_(ツ)_/¯

  • Projects
  • Prototypes
  • Coding
  • HowTos
  • Pinouts
  • Story time

Links

Github
  • About
works on my machine
¯\_(ツ)_/¯

Coding

Some useful and / or yummy code to remind my brain what I already forgot (again) – and for your amusement.

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

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

    ByStefan May 23, 2023

    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…

    Read More Deciphering the expected secret – Python this.s in a one linerContinue

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

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

    ByStefan February 13, 2023February 13, 2023

    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.

    Read More Where are they going? – int angle to direction mapping in PythonContinue

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

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

    ByStefan February 10, 2023February 13, 2023

    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…

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

  • Multitasking: “Fucking up multiple things at the same time!” – MicroPython uasyncio howto
    Coding

    Multitasking: “Fucking up multiple things at the same time!” – MicroPython uasyncio howto

    ByStefan January 24, 2023January 25, 2023

    Most code for simple IoT devices is a script with an endless loop with the code for the connected hardware like reading a sensor or polling something from the network followed by a delay. Keeping that pattern in mind helps to write new or convert your existing code for asynchronous execution. If you want to…

    Read More Multitasking: “Fucking up multiple things at the same time!” – MicroPython uasyncio howtoContinue

  • “These ARE the devices you are looking for” – a MAC based identifier in Python, Micropython and C++
    Coding

    “These ARE the devices you are looking for” – a MAC based identifier in Python, Micropython and C++

    ByStefan January 11, 2023May 8, 2023

    TLDR: Code for MAC address in (Micro)Python and C++ for D1 Mini, Raspberry devices and NodeMCU. I was looking for a unique static identifier to handle my IoT devices without baking the mqtt publish topics, name and location into the code. The code on identical devices should be the same, the the individual configuration should…

    Read More “These ARE the devices you are looking for” – a MAC based identifier in Python, Micropython and C++Continue

  • A snake with no name – Lambdas in Python (also functions and list comprehensions)
    Coding

    A snake with no name – Lambdas in Python (also functions and list comprehensions)

    ByStefan September 7, 2022September 8, 2022

    Sweet and short: Instead of a function you can write a single statement in Python as a lambda. Either is one either better or worse nor does one replace the other. They both have their place and intended use. Functions hopefully have describing names, are probably used multiple times and handle a specific part which…

    Read More A snake with no name – Lambdas in Python (also functions and list comprehensions)Continue

  • “You won’t get IN with THIS E-Mail” – Python Regex to validate email (formally)
    Coding

    “You won’t get IN with THIS E-Mail” – Python Regex to validate email (formally)

    ByStefan September 6, 2022September 7, 2022

    Currently did some text analysis with Python and Regex. Came up with an E-Mail format validation method which could help you with the same problem and remind me of it in the future. Import package re and use the compile method to get a regex pattern with which you can match your desired String.For evaluation…

    Read More “You won’t get IN with THIS E-Mail” – Python Regex to validate email (formally)Continue

Page navigation

Previous PagePrevious 1 2

© 2025 works on my machine

Privacy Policy

Scroll to top
  • Projects
  • Prototypes
  • Coding
  • HowTos
  • Pinouts
  • Story time
Search