https://blog.csdn.net/lady_killer9/article/details/81175682
不错的参考:https://blog.csdn.net/lady_killer9/article/details/79237116
常见用法
vector<int> v;
int num,start,end;
cin >> num>>start>>end;
//行尾添加
v.push_back(num);
//指定位置插入
v.insert(v.begin()+start,num);
//排序
sort(v.begin(),v.end());
everse(v.begin(),v.end());
//遍历
vector<int>::iterator it;
for(it=v.begin();it!=v.end();it++)
{
cout<<*it<<" ";
}
//指定位置删除
v.erase(v.begin()+start);
//区间删除
v.erase(v.begin()+start,v.begin()+end);
二维数组的定义
// 1
vector<pair<int, int> > v(N);
// 2
using pii = pair<int, int>;
vector<pii> v(N);
//3
vector<vector<int> > q(N,vector<int>(2,0));
将docker-compose.yml
放在根目录下
version: '3'
services:
mysql:
restart: always
container_name: mysql-docker # 指定容器的名称
image: mysql:latest # 指定镜像和版本
ports:
- 3306:3306
privileged: true
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_ROOT_HOST: 192.168.123.54
TZ: Asia/Shanghai # 指定时区
volumes:
- "./data:/var/lib/mysql" # 挂载数据目录
- "./config:/etc/mysql/conf.d" # 挂载配置文件目
- "./conf/my.cnf:/etc/my.cnf"
创建conf/my.conf
[mysqld]
character-set-server=utf8mb4
default-time-zone='+8:00'
innodb_rollback_on_timeout='ON'
max_connections=500
secure-file-priv=/
innodb_lock_wait_timeout=500
use mysql
select host,user from user;
update user set host='%' where user='root' and host='192.168.40.223';
flush privileges;
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安装wget
brew install wget
完全关闭 Parallels
打开终端,输入:
sudo vim /Library/Preferences/Parallels/network.desktop.xml
打开desktop.xml
文件,找到<UseKextless>0</UseKextless>
这一行,将其数值改成0
https://github.com/jiangxianli/SSHAutoLogin
curl -s https://www.jiangxianli.com/SSHAutoLogin/install.sh | bash -s mac
ssh-keygen -t rsa -C "jiangph1001@qq.com" -f ~/.ssh/id_rsa_2016
ssh-keygen -t rsa -C "jiangph1001@foxmail.com" -f ~/.ssh/id_rsa_1001
执行完以后,会在.ssh
目录下生成两对公私钥
$ ls
id_rsa_1001 id_rsa_1001.pub id_rsa_2016 id_rsa_2016.pub known_hosts
然后使用ssh-add
添加密钥到ssh-agent中
ssh-add ~/.ssh/id_rsa_2016
ssh-add ~/.ssh/id_rsa_1001
在.ssh
目录下新建config文件
# 2016
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_2016
# 1001
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_1001
具体过程略过
【注意事项】Windows电脑的名称不要设置为中文,不然会导致Mac无法挂载
例如挂载到/home/smb
目录
mount -t cifs //192.168.11.123/D /home/smb -o username=administrator,password=111111
上述命令挂载以后,该目录的权限是755,其他用户没有修改权限,需要通过以下命令增加权限
mount -t cifs //192.168.11.123/D /home/smb -o username=administrator,password=111111,dir_mode=0777,file_mode=0777