杂项
在基于 Intel 的 Mac 上,您可以在启动时使用 Command-R 来重新安装最新安装的 macOS 的当前版本。
Command Line Tools (CLT) for Xcode
xcode-select --install
Ubuntu 22.04 LTS 关闭 AppArmor 和 Uncomplicated Firewall
sudo systemctl stop apparmor.service
sudo systemctl disable apparmor.service
sudo ufw disable
VMware & CentOS 7.9 Guest
sudo yum update -y
sudo yum install -y open-vm-tools-desktop
sudo shutdown -r now
ls -l /mnt/hgfs
使用 Python3 虚拟环境在线开发和离线部署
##################################################################
python3 -m venv .venv
source .venv/bin/activate
# python3 -m pip install -U pip setuptools
python3 -m pip freeze > requirements.txt
python3 -m pip download -r requirements.txt -d .packages
deactivate
rm -rf .venv
##################################################################
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt --no-index -f .packages
deactivate
rm -rf .packages
##################################################################
嵌入Python
# 将嵌入的发行版解压缩到应用程序安装的子目录中
7z x python-3.10.11-embed-amd64.zip -o*
del python-3.10.11-embed-amd64.zip
cd python-3.10.11-embed-amd64
# 将 python310._pth 文件的内容修改为如下所示
############################################
python310.zip
.
..
# Uncomment to run site.main() automatically
import site
############################################
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py --no-warn-script-location
del get-pip.py
cd ..
# Example: playwright
python-3.10.11-embed-amd64\python -m pip install -U playwright
set PLAYWRIGHT_BROWSERS_PATH=ms-playwright
python-3.10.11-embed-amd64\python -m playwright install chromium
rmdir /s /q ms-playwright\.links
Python3 Script Template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import urllib3
try:
import simplejson as json
except ModuleNotFoundError as e:
import json
urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning)
def main():
print('[+] Good')
print('[-] Bad')
print('[!] Information')
print('[~] Processing')
print('[?] Question')
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt as e:
sys.exit(0)