Measure your VM with typeperf (Pandas py) perfmon

Azure disk-types https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types Ultra, Premium SSD, Standard SSD, Standard HDD. Max disk size 65,536 gibibyte (GiB) 32,767 GiB 32,767 GiB 32,767 GiB Max throughput 2,000 MB/s 900 MB/s 750 MB/s 500 MB/s Max IOPS 160,000 20,000 6,000 2,000 Premium SSD Azure premium SSDs deliver high-performance and low-latency disk support for virtual machines (VMs) with input/output […]

Cryptography with Python – Caesar Cipher

After reading (almost done) with: The Code Book : The Secret History of Codes and Code-Breaking Paperback – April 30, 2002by Simon Singh (Author) available at Amazon and so on I became fascinated with the history and the small stories that goes along with the different codes used and still being used today. Here is […]

Function app

https://docs.microsoft.com/en-us/azure/azure-functions/ First function Python https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?pivots=programming-language-python Linux, hm, must upload code from local The Azure Functions extension for Visual Studio Code. Azure icon click it, takes time Select a language for your function project: Choose Python.Select a Python alias to create a virtual environment: Choose the location of your Python interpreter. If the location isn’t shown, […]

Azure SDK Pyhon

https://azure.github.io/azure-sdk/python_introduction.html Python Guidelines: Introduction: Design principlesIdiomaticConsistentApproachableDiagnosableDependablePython Design Principles:–PEP 20 — The Zen of Python, import this https://www.python.org/dev/peps/pep-0020/ General Guidelines: https://azure.github.io/azure-sdk/general_introduction.html Gitub: https://github.com/azure/azure-sdk-for-python Supported python versions:Code style: https://www.python.org/dev/peps/pep-0008/ Naming conventions: service_client = ServiceClient() service_client.list_things() def do_something(): class ThisIsCorrect(object): pass MAX_SIZE = 4711 database_module.py Method signatures: DO NOT use, static, do not use get set, use properties […]

Docker-compose ubuntu (2019)

Install it from here, the two first lines https://get.docker.com/ curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh docker –version Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your […]

PEP 8

Programming Recommendations https://www.python.org/dev/peps/pep-0008/#programming-recommendations Use is not operator rather than not … is. While both expressions are functionally identical, the former is more readable and preferred. Always use a def statement instead of an assignment statement that binds a lambda expression directly to an identifier. Derive exceptions from Exception rather than BaseException. Direct inheritance from BaseException […]

Python debugging in VS Code

Debugging 101 https://github.com/microsoft/vscode-recipes/tree/master/debugging%20python We need VSC, Python extension and a launch.json with the minimum of integrated and external. Click on the Debugging icon in the Activity Bar to bring up the Debug view. Then click on the gear icon to configure a launch.json file, select Launch for the environment. (Some .Net software will be installed) […]

Python, lxml and Xpath

https://lxml.de/xpathxslt.html https://www.w3schools.com/xml/xpath_syntax.asp Read a file with xml, convert it to a string from bytes: pip install lxml from lxml import etree as et Make dictionary (duplicate keys, get atr) result: Code: def xml_to_dict(xmlfile): msg = {} count = 1 with open(xmlfile) as r: xml = r.read() print(type(xml)) parser = et.XMLParser(recover=True, collect_ids=True) root = et.fromstring(bytes(xml, encoding=”utf-8″), parser) x = root.xpath(“//*”)# get all #x […]

Python as systemctl service

https://www.loggly.com/blog/new-style-daemons-python/ https://github.com/torfsen/python-systemd-tutorial This is an easy and not enough tested script, you may also enable it to start at boot. Read about systemctl: https://www.freedesktop.org/software/systemd/man/systemctl.html So create a file in /lib/systemd/system touch python_service.service sudo nano python_service.service run the script with (when it is done and has no erros): This is my test script: It prints service […]