https://www.packtpub.com/product/programming/9781800207721 The new edition of Mastering Python includes many new chapters and all chapters have either been revised or completely rewritten. What’s new? New Python features up to Python 3.10 Extensive section on Structural Pattern Matching (PEP 622/PEP 634). The Python Switch Statement. Completely rewritten asyncio chapter. New Scientific Python chapter featuring libraries such as […]
Altering Postgres int columns to enum type
Many applications have need for a sort of “enum” field at some point. If you’re like me, you’ve probably used a sort of enum mapping in your code to map the numbers to the actual values so you don’t waste space by having duplicated text/varchar columns. With PostgreSQL you can easily convert these to an […]
Adding dynamic dns hostnames to Django INTERNAL_IPS
While some of us are blessed with fixed IP addresses, some ISPs don’t offer this option unfortunately. If you’re using the Django INTERNAL_IPS setting to show or hide the debug toolbar this can be a problem. Luckily the Django settings.py files are pure Python and it’s easy enough to work around this issue with a […]
Installing Go on Ubuntu 16.04, the easy way
There are many articles on the web telling you to install and compile Go from source. That’s a perfectly valid option but overkill if you simply need some Go apps. Without further ado the simple method of installing Go on Ubuntu (zsh is assumed, for bash use .bashrc instead of .zshrc): apt-get install golang echo […]
Controlling a ESP8266 H801 Wifi controller through Python
These controllers can be bought for about ~$10 from Aliexpress which makes it possible to light an entire room with LEDs for about ~$20 if you wish. Controlling them is pretty easy too, besides the available Android application, the protocol is actually fairly simple. The controller: RGBWW LED Strip Light WiFi Controller Dimmer ESP8266 (Android […]
Mastering Python
Mastering Python is finally out and available in your local book store. If you are an experienced Python developer, this might be the book for you. It will teach you the useful new features in Python 3 (currently up to 3.5) and show you a lot of Python tricks that you may not have seen […]
Increasing transmit power on an ASUS RT-AC68U wifi router
BIG WARNING: Increasing your router to it’s maximum power can reduce it’s life expectancy, cause problems for your neighbours, can be illegal depending on your location and in some cases even has the potential to cause actual dangerous situations since RADAR can share this frequency! Taking the above warning into consideration, the allowed transmit power […]
Maximum wifi transmission power per country
Note: for a more up to date overview look at the Linux Kernel: https://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git/tree/db.txt For some reason it appears that this is quite hard to come by, most documentation only talks about the transmission power in dBm which is just less easy to read than mW to me. So here’s a list of the maximum allowed transmission […]
Rendering your STL files with matplotlib using numpy-stl
It’s been a while since the first version of numpy-stl and a lot has changed since. Most importantly, usage has become even easier. So here’s a demo on how to use matplotlib to render your stl files: [python]from stl import mesh from mpl_toolkits import mplot3d from matplotlib import pyplot # Create a new plot figure […]
Reading MT940 files using Python
Some time ago I wrote a library to read MT940 files with Python. While there are multiple libraries available for this target, none of the others really work properly and/or support all variants of the format. The MT940 library I wrote is slightly different, it’s designed to be able to parse any MT940 file, regardless […]