Shell 获取当前脚本文件路径

以下代码适用于 bash 和 zsh: # 此脚本文件的绝对路径 SCRIPT_FILE=$(readlink -f $0) # 此脚本文件所在文件夹的绝对路径 SCRIPT_DIR=$(dirname $SCRIPT_FILE) # 注意:这两行要分开写,不要合并成一句,否则变量内容为空

Python 使用 nacl 生成密钥对

import nacl.signing import nacl.public def generate_ed25519_keypair(): "return (public_key, private_key)" signing_key = nacl.signing.SigningKey.generate() pk = signing_key.verify_key._key sk = signing_key._signing_key return (pk, sk) def generate_curve25519_keypair(): "return (public_key, private_key)" sk = nacl.public.PrivateKey.generate() pk = sk.public_key return (pk, sk)

Install pip3 on Ubuntu

本文章引用自: https://www.educative.io/edpresso/installing-pip3-in-ubuntu ,版权归原作者所有。 pip3 is the official package installer for Python 3. It can be used to install packages from the Python Package Index. Installation Step 1 - Update systemIt is always a good idea to update before trying to install a new package. Run the command below: sudo apt-get update Step 2 - Install

pip 安装 Python 库到指定目录

可以使用 t (target) 选项来指定安装的位置。 举例: pip install -r requirements.txt -t /path/to/directory 安装到当前路径: pip install -r requirements.txt -t . 参考 https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-t

AWS CLI S3 从存储桶下载和上传文件

可以使用 cp 复制,或 sync 同步,或者 mv 移动 https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html 单个文件的下载和上传下载文件 aws s3 cp <S3Uri> <LocalPath> 上传文件 aws s3 cp <LocalPath> <S3Uri> S3Uri 格式:s3://bucket-name/ob

AWS CLI 下载 S3 文件

单个文件的下载aws s3 cp S3URI local_file_name 示例:aws s3 cp s3://bucket-name/object-key local-file-name 下载目录(prefix)中的文件 sync mb rb ls

AWS 在IAM控制台创建管理员账号

创建一个管理员账号 打开 IAM 控制台 ,选择创建一个管理员账号 Add User Access type 选上 Programmatic access Permissions 选 Attach existing policies directly。然后 Policy 选 AdministratorAccess 下一步,直到显示 Access Key ID 和 Secret Access Key 页