Python

Python PIP3

Python PIP https://pip.pypa.io/en/stable/cli/pip_list/ https://blog.stoege.net/posts/pip/ OpenBSD 7.1 # python3 --version Python 3.9.12 # python3 -m pip --version pip 22.0.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9) List installed Packages python3 -m pip list List outdated Packages python3 -m pip list --outdated --format columns Any Comments ? sha256: 6ada0942bc4d02ee477ab233571e893547049a379479b61910541e561d2f053a

Little Mail Validator in Python

wrote a little Mail Adresse Validator in Python. use it, modify it, like it … best practice for python is to use a virtual env like Poetry (or virtualenv) and add the “email-validator” module like this: poetry add email-validator Code few lines of code … #!/usr/bin/env python3 from email_validator import validate_email, EmailNotValidError ok=[] nok=[] emails = [ "[email protected]", "[email protected]", "[email protected]", "[email protected]", "asf.asdf", "[email protected]", "[email protected]" ] print ("\nMy Little Mail Validator\n") for email in emails: try: # Validate.

Python

Python Snippets RealPython Best Practices: https://realpython.com/tutorials/best-practices/ Remove a substring from the end of a string url = "abcdc.com" url.removesuffix(".com") # Returns 'abcdc' url.removeprefix("abcdc.") # Returns 'com' or url = "abcdc.com" if url.endswith(".com"): url = url[:-4] or regex import re url = "abcdc.com" url = re.sub("\.com$", "", url) Modul ‘ping3’ “Permission Denied” on Linux https://github.com/kyan001/ping3/blob/master/TROUBLESHOOTING.md#permission-denied-on-linux echo "# allow all users to create icmp sockets" > /etc/sysctl.d/ping_group.conf echo "net.ipv4.ping_group_range=0 2147483647" > /etc/sysctl.d/ping_group.conf sysctl net.

Poetry

1. Intro Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Links https://python-poetry.org/ https://www.infoworld.com/article/3527850/how-to-manage-python-projects-with-poetry.html Install on OpenBSD Wanna Install on OpenBSD ? # get root doas su - Install as Root # Install Poetry pip3 install --user poetry # on error PEP 668: #pip3 install --user poetry --break-system-packages # Update Poetry pip3 install poetry -U # Update Profile cat << EOF >> ~/.

Cheatsheet

Curl from @linuxopsys NMAP from @hackingarticles 5 Years Later, Is Docker Still Delivering ? Beginner Python CheatSheet NoStarch Docker CLI Cheat Sheet Docker Command Cheat Sheet Visual Studio Code for macOS Linux Netzplan CT Ansible Edureka Windows Events NMAP SQL Stuff Bash Convention and Libraries Assembler 80186 and higher HTTP Status Codes Python Cheatsheet - Olivier La Flamme Data Wrangling with pandas Cheat Sheet OWASP Key Management Cheat Sheet Python Cheatsheet

Python Pip

Python PIP https://pip.pypa.io/en/stable/cli/pip_list/ how to PIP with OpenBSD … Already Installed ? doas pkg_info -Q py3-pip py3-pip-20.1.1p0 (installed) Install pip3 doas pkg_add py3-pip-- doas ln -sf /usr/local/bin/pip3.9 /usr/local/bin/pip Search doas pip search csvkit Install csvkit doas pip install wheel csvkit Upgrade pip doas pip install --upgrade pip Upgrade pip packages for i in $(pip list -o | awk 'NR > 2 {print $1}'); do doas pip install -U $i; done or doas pip install pip-review doas pip-review --interactive Any Comments ?