With few or no explanations, on Debian 10: The actual API app, in ~/resttest/resttest.py: ~/resttest/wsgi.py: /etc/systemd/system/resttest.service: /etc/nginx/sites-available/resttest: Final setup steps: Testing results: Also note that the Swagger UI is automatically accessible in http://my.server.name/: Some future considerations: TLS encryption (= reconfiguring NGINX) Authentication for the API Disabling/customizing the Swagger UI Links: Flask Flask-RESTPlus NGINX The post […]
PuTTY Settings in 2019 – Now in Multicolor!
I’ve “always” used PuTTY as my SSH client on Windows. And now, in 2019, I realized that there really are some settings in PuTTY that can make a difference! Here is my earlier normal view: Bash prompt and the colors looked like this: Not very modern, right? After some adjustments, here they are now: For […]
Version Numbering in Python Package
A revisit for this topic is available in: Revisited: Version Numbering in Python Package After written the short Python package post I realized that the version number (actually string but anyway) of the package is now in two different places: in the package code (__init__.py) and in the package install metadata (setup.py). Obviously that’s not […]
Zabbix Protocol Dissector for Wireshark
While troubleshooting a Zabbix communication problem I realized that there was no Zabbix protocol dissector in Wireshark. Long story short: I wrote my own dissector in Lua as an exercise. Actually, I wrote two dissectors, one for Zabbix passive agent communication (port 10050, the not-so-json-style protocol) and one for other Zabbix components (port 10051). You […]
Creating a Python Package, the Cruel Way
This is how you can create a package of Python code so that you can use the module in various projects. Let’s assume this is the code your module has: STUFF_VERSION = “1.1-dev” def get_stuff(): return “This is stuff. Use it wisely.” Of course the module can be much more complicated with various functions and […]
Oneshot Service in Linux Systemd
My trusty old VDR box started behaving erratically: sometimes the IR remote didn’t do anything. Rebooting the whole box usually helped, but not always. Eventually I was able to narrow the problem down: for some reason the LIRC serial driver did not correctly detect the IR receiver in the serial port at the boot. I […]
Configuration File Parsing in Python
Example of configuration file parsing in Python: With the configuration file configtest.cfg: Example output: More information: https://docs.python.org/3/library/configparser.html Also available in GitHub: https://github.com/markkuleinio/python-config-parsing
Logging in Python
Example of configuring logging in Python: Output: More information: https://docs.python.org/3/library/logging.html
Argument Parsing in Python
Example of command line argument parsing in Python: Output: More information: https://docs.python.org/3/library/argparse.html Also available in GitHub: https://github.com/markkuleinio/python-argument-parsing
Linux Routing Memos
These are just small hints and memos what to do on a Debian Linux setup. This is not a complete guide on doing a secured routing environment with Linux. /etc/sysctl.conf: net.ipv4.ip_forward=1 Configure /etc/network/interfaces iptables -t nat -A POSTROUTING -o <upstream_interface> -j MASQUERADE apt-get install iptables-persistent apt-get install iftop apt-get install conntrack conntrack -L -s 10.11.1.10 […]

