info

MySQL——数据库基础操作

匆匆过客 提交于 2019-12-06 17:00:43
基本操作命令 1、查看数据库列表信息 show databases; mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.11 sec) 2、查看数据库中的数据表信息 (1)进入数据库 use mysql; mysql> use mysql; Database changed (2)查看数据表 show tables; mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | engine_cost | | event ...... 3、显示表结构信息(字段) describe user; (1)其中PRI为主键(不能为空) 定义——确定表中唯一实体对象的标识 特点——唯一性、非空性 (2)其中Extra为约束条件 mysql> describe user; +--------

如何在不清楚有哪些tag的情况下拉取docker镜像?

橙三吉。 提交于 2019-12-06 16:50:57
安装reg go get github.com/genuinetools/reg 使用 reg tags nginx 输出如下 INFO[0000] domain: docker.io INFO[0000] server address: https://registry-1.docker.io 1 1-alpine 1-alpine-perl 1-perl 1.10 1.10-alpine 1.10.0 1.10.0-alpine 1.10.1 1.10.1-alpine ... 配合fzf快速定位自己想要的tag reg tags nginx | fzf 最后总结成alias方便使用 alias cpull='cpull(){docker pull $1:$(reg tags $1| fzf);};cpull $@' 来源: https://www.cnblogs.com/futuretea/p/11995510.html

python更新字典下嵌套数组下嵌套字典的值

吃可爱长大的小学妹 提交于 2019-12-06 16:43:46
已知从外层到里层:字典-->数组-->字典的数据: datas = {'product_info': '[{"qty":"1","name":"football","price":"20","url":"www","attribute":"","image":""}]'} 需要更新qty的值为3 (1)将键product_info的值由str转为dict import json product_info_value = json.loads(datas['product_info'])[0] product_info_value的结果为: {'qty': '1', 'price': '20', 'url': 'www', 'name': 'football', 'attribute': '', 'image': ''} (2)更新product_info_value 字典中qty的值 product_info_value['qty'] = '3' 此时product_info_value的结果为: {'qty': '3', 'price': '20', 'url': 'www', 'name': 'football', 'attribute': '', 'image': ''} (3)将product_info_value由字典格式变成str,并赋值给datas['product

第3-课电影天堂爬虫实战

那年仲夏 提交于 2019-12-06 14:53:38
#电影天堂电影爬虫 import requests from lxml import etree import time DOMAIN = "https://dytt8.net" HEADERS = { "Referer": "https://dytt8.net/html/gndy/dyzz/index.html", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" } #获取元素对象 def get_page_info(url,flag=True): html = "" my_time = 0 time.sleep(1) while(True): response = requests.get(url=url,headers=HEADERS) if response.status_code == 200: if flag: text = response.text else: text = response.content.decode("gbk") html = etree.HTML(text) break else: my_time = my_time + 1 #

一个简单的爬虫:爬取豆瓣的热门电影的信息

你离开我真会死。 提交于 2019-12-06 14:51:31
1 #! /usr/bin/env python 2 # -*- coding=utf-8 -*- 3 4 import requests 5 import json 6 import re 7 8 f = open('dianying.txt','a') 9 count = 0 #用于记录编号,也可不用 10 def write__(htm): 11 #with open('title.txt', 'a') as fff: 12 titl = re.findall('data-tit(.*?)data-enough',htm.text,re.S) #找到data-tit和data-enough之间的所有匹配串,titl是列表类型 13 for each in titl: #依次迭代列表中元素,针对每一组元素 分别匹配相应的字段 ,并将字段内容写入文本 14 #fff.write(each + "\n") 15 info = {} 16 info['title'] = re.search('le="(.*?)"',each,re.S).group(1) #匹配值的第一个 17 info['year'] = re.search('data-release="(.*?)" data-rate',each,re.S).group(1) #匹配值的第一个 18 info['Rating']

文件上传接口

删除回忆录丶 提交于 2019-12-06 14:41:55
public function commonUpload(){ $uploadDir = sprintf( './Public/Uploads/%s/',date('Ym') ); if ( !is_dir($uploadDir) ){ mkdir($uploadDir,0777,true); } $upload = new \Think\Upload(); $upload->maxSize = 3145728; $upload->exts = [ 'doc','docx','xls','xlsx','pdf','txt','jpg','png' ]; $upload->rootPath = $uploadDir; $upload->saveName = array('uniqid',''); $upload->savePath = ''; $upload->subName = []; $info = $upload->uploadOne($_FILES['file']); if ( empty($info) ) { $this->ajaxReturn([ 'code' => 500, 'msg' => '上传失败:' . $upload->getError(), 'data' => '' ]); } $this->ajaxReturn([ 'code' => 200, 'msg'

linux免密钥登录

大兔子大兔子 提交于 2019-12-06 14:39:48
目录 linux免密钥登录原理 生成密钥对及分发密钥 分发过程 验证结果 主机ip内容文件 输出ok验证结果 安装pssh工具 输出ping验证结果 获取ip验证结果 linux免密钥登录原理 1.本机生成密钥和公钥 2.把公钥传递给远程主机 3.主机把公钥追加进免检名单 ---------------------上面为第一次配置的时候-----------------------配置完毕以后只用下面的步骤------------------------- 4.本机请求远程主机 5.远程主机去免检名单里找到所属公钥 6.生成用公钥加密后的字符串传回本机 7.本机使用私钥进行解密 8.本机把解密后的信息传给远程主机 9.远程主机进行验证 10.登录成功 生成密钥对及分发密钥 #!/bin/bash #生成rsa算法密钥 #分发给指定机器 sleep 2 head_ip='172.16.91.' #删除本地初始密钥对 rm -rf /root/.ssh sleep 1 echo -e "删除完成\n" echo "开始分发" echo "\n" echo "++++++++++++++++++++" ssh-keygen -t rsa -f /root/.ssh/id_rsa -P "" arr=(104 120 121 122 123 124 ) for ip in ${arr[@]

面向对象编程OOP

为君一笑 提交于 2019-12-06 14:35:33
面向对象特征:1、封装(对象具备行为能力写到方法里,便于重用和扩展,提高可维护性可扩展性) 2、继承 3、多态 class Book:#定义,Passic命名法,第一个字大写 def __init__(self,title,price,author):#类成员,写一个构造函数,下划线是预定义,逗号后面是传递初始化值 self.title = title#当前这本书的标题是你传过来的标题 self.price = price self.author = author def print_info(self):#加入一些行为 print(self.title,self.price,self.author) #以上的类只是一个模板,并不代表具体哪本书 #以下写入main方法 if __name__ == '__main__':#实例化的过程 book = Book('Python经典',price=20.0,author='Tom') book.print_info() 在console下 In[2]: import main In[3]: b = main.Book('Python') In[4]: b.price Out[4]: 0.0 In[5]: b Out[5]: <main.Book at 0x25428181f98> 想显示b具体的值 使用repr class Book:

Kubernetes1.16下部署Prometheus+node-exporter+Grafana+AlertManager

大城市里の小女人 提交于 2019-12-06 14:21:06
Prometheus 持久化安装 我们prometheus采用nfs挂载方式来存储数据,同时使用configMap管理配置文件。并且我们将所有的prometheus存储在 kube-system #建议将所有的prometheus yaml文件存在一块 mkdir /opt/prometheus -p && cd /opt/prometheus #生成配置文件 cat >> prometheus.configmap.yaml <<EOF apiVersion: v1 kind: ConfigMap metadata: name: prometheus-config namespace: kube-system data: prometheus.yml: | global: scrape_interval: 15s scrape_timeout: 15s scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] EOF # 配置文件解释(这里的configmap实际上就是prometheus的配置) 上面包含了3个模块global、rule_files和scrape_configs 其中global模块控制Prometheus Server的全局配置 scrape

[转] console.log的高级用法

你说的曾经没有我的故事 提交于 2019-12-06 14:15:51
//基本用法 console.log('最常见用法\n换行');console.error('输出错误信息 会以红色显示');console.warn('打印警告信息 会以黄色显示');console.info('打印一般信息');console.clear();//清空上面的console显示 //进阶用法 console.assert(false,'判断为false才显示的信息');//console.assert(bool,”info”) 如果bool为false 打印出info 否则不打印console.table([['中国','美国'],['好']]);//传入的对象或数组以表格方式显示function fn(){ console.trace(); }//打印 调用链 fn2()调用fn1(),fn1()调用fn()function fn1(){ fn(); }function fn2(){ fn1(); }fn2(); //格式化输出 console.log支持的格式标志有: %s 占位符 %d 或 %i 整数 %f 浮点数 %o%O object对象 %c css样式 console.log('%d + %d = %d',1,2,3); //%o%O打印dom节点时就不一样 console.log('%o',document.body); console.log('