Author: jpuyy

  • curl 测试时设置超时时间

    使用curl时,有两个超时时间:一个是连接超时时间,另一个是数据传输的最大允许时间。

    连接阶段超时时间用 –connect-timeout 参数
    整个过程的最大允许时间用 -m 参数

    例如:

    curl --connect-timeout 10 -m 20 http://jpuyy.com/

    连接超时的话,出错提示形如:

    curl: (28) connect() timed out!

    数据传输的最大允许时间超时的话,出错提示形如:

    curl: (28) Operation timed out after 2000 milliseconds with 0 bytes received

  • 打乱文件的行顺序

    命令

    shuf

    参考:http://x-wei.github.io/%E6%89%93%E4%B9%B1%E6%96%87%E6%9C%AC%E7%9A%84%E8%A1%8C.html

  • python smtplib 发邮件

    http://www.mkyong.com/python/how-do-send-email-in-python-via-smtplib/

  • centos7 python 升级

    脚本

    #!/bin/bash
    
    yum install -y gcc make
    cd /usr/src
    curl -O https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
    tar xzf Python-2.7.12.tgz
    cd Python-2.7.12
    ./configure
    make altinstall
    

    CentOS 7 安装 python 3.6.5

    sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm
    sudo yum install -y python36u python36u-libs python36u-devel python36u-pip
    

    CentOS 7.7, Python 3 is available in the base package repository

    # cat /etc/redhat-release 
    CentOS Linux release 7.7.1908 (Core)
    # yum install -y python3 python3-devel
    
  • Dockerfile

    CMD

    CMD 是 docker 启动时运行的命令,在 Dockerfile 中只能指定一条 CMD 命令

    EXPOSE

    暴露端口

  • docker 镜像

    查看本地 docker 镜像

    docker images

    查看 repositories

    curl -XGET http://127.0.0.1:5000/v2/_catalog

    查找 registry 中的镜像

    docker search ansible

    删除所有镜像

    docker rmi `docker images -a -q`