西维蜀黍

【AWS】AWS CLI 使用

Install AWS CLI V2

$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /

Verify the installation

To verify that the shell can find and run the aws command in your $PATH, use the following commands.

$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.0.36 Python/3.7.4 Darwin/18.7.0 botocore/2.0.0
  ...


【AWS】s3cmd 使用

Install

Windows

直接执行.py源文件

Install Python

Download and install python 3

https://www.python.org/downloads/

After installing python, append the Python in Path environment variable. Open command prompt and verify python version.

C:> python3 --version
Python 3.9.4

Download s3cmd

$ git clone https://github.com/s3tools/s3cmd.git

# 解压

$ cd s3cmd

$ python3 s3cmd --configure

Verify

$ python3 s3cmd ls

2014-02-03 06:37  s3://tecadmin
2014-03-29 07:56  s3://tecadminbackups
  ...


【Compile】交叉编译器(Cross Compiler)

本地编译

本地编译可以理解为,在当前编译平台下,编译出来的程序只能放到当前平台下运行。平时我们常见的软件开发,都是属于本地编译:

比如,我们在 x86 平台上,编写程序并编译成可执行程序。这种方式下,我们使用 x86 平台上的工具,开发针对 x86 平台本身的可执行程序,这个编译过程称为本地编译。

交叉编译(Cross compiler)

交叉编译可以理解为,在当前编译平台下,编译出来的程序能运行在体系结构不同的另一种目标平台上,但是编译平台本身却不能运行该程序:

比如,我们在 x86 平台上,编写程序并编译成能运行在 ARM 平台的程序,编译得到的程序在 x86 平台上是不能运行的,必须放到 ARM 平台上才能运行。

为什么会有交叉编译

之所以要有交叉编译,主要原因是:

  • Speed: 目标平台的运行速度往往比主机慢得多,许多专用的嵌入式硬件被设计为低成本和低功耗,没有太高的性能
  • Capability: 整个编译过程是非常消耗资源的,嵌入式系统往往没有足够的内存或磁盘空间
  • Availability: 即使目标平台资源很充足,可以本地编译,但是第一个在目标平台上运行的本地编译器总需要通过交叉编译获得
  • Flexibility: 一个完整的Linux编译环境需要很多支持包,交叉编译使我们不需要花时间将各种支持包移植到目标板上
  ...


【Linux】Ubuntu 安装 Docker

Installation

Method 1 - Convenience Script

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
<...>

If you would like to use Docker as a non-root user,

Approach 1

$ sudo sh -eux <<EOF
# Install newuidmap & newgidmap binaries
apt-get install -y uidmap
EOF

$  dockerd-rootless-setuptool.sh install

# Verify that you can run docker commands without sudo.
$ docker run hello-world

Approach 2

you should now consider adding your user to the “docker” group with something like:

$ sudo usermod -aG docker ${USER}

# 将当前用户切换到docker组中,且立即生效
$ newgrp docker

# Verify that you can run docker commands without sudo.
$ docker run hello-world
  ...


【Linux】Shell

判断 - if

#!/bin/bash
# Basic if statement
if [ $1 -gt 100 ]; then
  echo Hey that\'s a large number.
  pwd
fi
  ...