Interview Prep/Python for DevOps/Best practices & rapid-fire commands

Rapid fire: one-liners useful during an incident.

IntermediateConceptBest practices & rapid-fire commands
Answer
python3 -m http.server 8000 --bind 127.0.0.1            # serve a directory
python3 -m json.tool response.json                      # pretty-print JSON
python3 -c 'import yaml,sys,json; print(json.dumps(yaml.safe_load(sys.stdin)))' < values.yaml
python3 -c 'import secrets; print(secrets.token_urlsafe(32))'
python3 -c 'import socket; print(socket.gethostbyname("db.internal"))'
python3 -m timeit '"-".join(map(str, range(100)))'
All Python for DevOps questions Roadmap: Python for automation

More on Best practices & rapid-fire commands