编程小技巧

1. composer 跟换镜像源

国内稳定镜像源

https://mirrors.aliyun.com/composer/                           #阿里云#
https://mirrors.cloud.tencent.com/composer/              #腾讯云#
https://mirrors.huaweicloud.com/repository/php/      #华为云#

全局配置(阿里云为例)

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

项目配置

#更改项目中的composer.json文件, 增加一条“repository”#
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
    },
    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "https://mirrors.aliyun.com/composer/"
        }
    }
}

2. 输入框去掉聚焦之后的蓝色边框

input:focus{
  outline: none !important;
  box-shadow: none !important;
}

3. pip 使用国内的镜像源

国内稳定的镜像源

https://pypi.tuna.tsinghua.edu.cn/simple    // 清华
http://mirrors.aliyun.com/pypi/simple/   // 阿里云
https://pypi.mirrors.ustc.edu.cn/simple/  // 中科大

临时启用

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --trust -host=pypi.tuna.tsinghua.edu.cn   BeautifulSoup4

全局使用

配置文件内容

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn

linux 把内容放在 ~/.pip/pip.conf 文件中

window 把内容放在 user用户目录中创建一个名为 pip 的文件夹下的pip.ini 文件中(例如我的在 C:\Users\Lqg\pip\pip.ini 文件中)

4. centos8 防火墙增加端口

 firewall-cmd --zone=public --add-port=27017/tcp --permanent

5. 多行文字加引号后,转一行文字逗号分隔

 cat c.txt | sed 's/.*/"&",/g' | tr "\n" " "

6. 查看数据库的链接

select * from information_schema.processlist WHERE HOST = '10.0.51.195' AND DB LIKE '%lianshan%';
show variables like '%timeout%';

7. centos 时间同步

sudo yum -y install ntpdate
sudo ntpdate -u  ntp1.aliyun.com

8. laravel 数据迁移指定文件

php artisan migrate --path=database/migrations/2022_04_28_132250_v611.php

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注