CMakeLists.txt常用语法
设置debug模式
export BUILD_TYPE=Debug
cd build目录下
cmake -G "Xcode" ..
设置debug模式
export BUILD_TYPE=Debug
cd build目录下
cmake -G "Xcode" ..
防火墙状态 service iptables status
永久关闭防火墙 chkconfig iptables off
启用systemctl systemctl disenable auto-proxy.service
停用systemctl systemctl enable auto-proxy.service
查看systemctl所有运行服务 systemctl list-units --type=service --state=running
数据库备份mysqldump -u root -p -A > xx.xql
数据库还原 mysql -uroot -p < xx.xql
查看端口服务监听状态 netstat -nlp |grep LISTEN
查看socat进程个数 ps -ef | grep socat | wc -l
lnmp下开启thinkphp路由 cd到/usr/local/php/etc/php.ini 修改cgi.fix_pathinfo = 1 [修改后——如果没有,自行添加]
将远程服务器映射到本地
ssh -D 127.0.0.1:50000 root@vps.xxxx.com -N
开启jupyter notebook --no-browser --ip=0.0.0.0
ip link set wlp2s0 promisc on
ip link set enp1s0 promisc on
docker stop $(docker ps -a -q) #停止所有服务
docker rm $(docker ps -a -q) #删除所有容器
docker network create -d macvlan --subnet=192.168.10.0/24 --gateway=192.168.10.1 -o parent=wlp2s0 maclan
docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=enp1s0 maclan
docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o parent=enp1s0 macwan
docker network create -d bridge --subnet=192.168.10.0/24 --gateway=192.168.10.1 bridge_openwrt
docker network connect maclan openwrt
docker exec -it openwrt /bin/sh
create_ap -n wlp2s0 -g 192.168.10.21 xxx Donkey1213
ifconfig br-7875544b7a46 192.168.10.20 netmask 255.255.255.0
docker run --restart always -d --name=openwrt --network maclan --privileged kiddin9_openwrt /sbin/init
docker run --restart always -d --name=openwrt --privileged kiddin9_openwrt /sbin/init
docker run --net wifi --privileged -it OpenWrt /bin/bash
docker run --restart always -d --name=OpenWrt --network wifi --privileged kiddin9_openwrt /sbin/init
docker run –restart always –name openwrt kiddin9_openwrt -d –network openwrt –privileged /sbin/init
nmcli device wifi hotspot con-name xxx ssid xxx password Donkey1213
nmcli connection modify xxx 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared ipv4.address 192.168.10.1/24 ipv4.gateway 192.168.10.2
nmcli connection up xxx
nmcli connection down xxx
nmcli con modify xxx ipv4.method manual
nmcli con modify xxx ipv4.gateway 192.168.10.1
nmcli con modify xxx ipv4.address 192.168.10.3/24
nmcli connection show xxx #查看热点信息
traceroute baidu.com
docker run --net wifi --ip 192.168.10.10 --mac-address=<MAC_ADDRESS> --device=<NIC_DEVICE_NAME> -it myimage /bin/bash
config interface 'lan'
option ifname 'eth0'
option proto 'static'
option netmask '255.255.255.0'
option gateway '192.168.0.1'
option ip6assign '60'
option dns '8.8.8.8 114.114.114.114'
option ipaddr '192.168.0.254'
option broadcast '192.168.0.255'
1.cin.getline()此函数可读取整行,包括前导和嵌入的空格,并将其存储在字符串对象中。
2.strlen()获取字符数组长度
3.ASCII A:65 a:97
2047:【例5.16】过滤空格
过滤多余的空格。一个句子中也许有多个连续空格,过滤掉多余的空格,只留下一个空格。
#include <iostream>
#include <cstring>
using namespace std;
char s[202];
char s2[202];
int main()
{
cin.getline(s,200);
int len=strlen(s);
s2[0]=s[0];
int n2=1;
for(int n=1;n<len;n++){
if(!(s[n]==' '&&s[n-1]==' ')){
s2[n2++]=s[n];
}
}
cout<<s2;
return 0;
}
对给定的n(1≤n≤20)个国家名(国家名字长度不超过20),按其字母的顺序输出。
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
#include<string>
using std::string;
#include<algorithm>
using std::swap;
int main()
{
int n = 0;
string a[20];
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> a[i];
}
for (int i = 0; i < n - 1; ++i)
{
for (int j = 0; j < n - i - 1; ++j)
{
if (a[j] > a[j + 1])
{
//直接比较大小就是比较首字母的ascii码
swap(a[j], a[j + 1]);
}
}
}
for (int i = 0; i < n; ++i)
{
cout << a[i]<<endl;
}
}