自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 收藏
  • 关注

原创 git 常用操作

git提交及合并操作

2022-06-14 16:48:28 206

原创 python ansible使用(2)playbook

# vim playbook.yml #内容如下:---- hosts: all remote_user: "{{remote_user}}" #become: yes # 全局设置切换用户 #become_method: su #become_user: root #gather_facts: false tasks: # gather_facts: 默认true;ansible的变量,例如ansible_distribution; # ...

2021-09-07 18:06:34 377

原创 python ansible使用(1)ansible-api

python2.7.5 ansible==2.7.0# -*- coding:utf8 -*-import osimport sysimport logging# from collections import namedtuplefrom ansible.vars.manager import VariableManagerfrom ansible.inventory.manager import InventoryManagerfrom ansible.parsing....

2021-09-07 17:59:20 1464 1

原创 shell 获取磁盘可用空间最大的挂载盘

# 获取磁盘可用空间最大的挂载点df -mlT -x tmpfs -x devtmpfs -x iso9660 | grep -v "/boot"|grep -v '挂载点'|grep -v 'Mounted on'| sort -n -k 5| tail -1 | awk '{print$NF}'root@dev001 ~ # df -mlT -x tmpfs -x devtmpfs -x iso9660 | grep -v "/boot"| sort -n -k 5文件系统 ...

2021-08-31 19:24:34 559

原创 python使用RSA加密

安装第三方包Crypto:pip install pycryptodome==3.10.1import base64from Crypto import Randomfrom Crypto.PublicKey import RSAfrom Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5class RSATool(): """ RSA加密是一种非对称加密,通常使用公钥加密,私钥解密,私钥签名,公钥验签。..

2021-08-26 17:26:47 2025

原创 shell 获取系统信息cpu、内存、磁盘

#!/bin/bash# 获取系统cpu、内存、磁盘信息脚本# 查看逻辑CPU的个数CpuCount=`cat /proc/cpuinfo| grep "processor"| wc -l`# 总内存大小GBMemTotal=`awk '($1 == "MemTotal:"){printf "%.2f\n",$2/1024/1024}' /proc/meminfo`# 磁盘大小GB,排除tmpfs类型DiskTotal=`df -k | grep -v "tmpfs" | egre...

2021-06-30 14:56:38 1415

原创 scan returned empty file list; check that path exists and contains files in scope of configuration

Ubuntu上安装和使用恶意软件检测工具 LMD 及杀毒引擎 ClamAV;安装参考:https://yq.aliyun.com/articles/87014本人在/usr/local/maldetect/conf.maldet 配置文件中设置了cpulimit 限制cpu的使用1、maldetect 安装后执行扫描无效果maldet --scan-all /tmproot@sxs-dev16:~# maldet --scan-all /tmpLinux Malware Dete.

2021-02-05 17:45:37 429

原创 ubuntu20 编译安装alisql 5.6.23 [sql/CMakeFiles/sql.dir/build.make:962: sql/CMakeFiles/sql.dir/sql_acl.cc

ubuntu20 编译安装 alisql 5.6.32 报错:/srv/mysql/src/sql/sql_acl.cc:3071:59: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 3071 | if (combo->plugin.str == NULL || combo->plugin.str == '\0') |

2021-01-29 17:10:49 735 3

原创 syntax is ok nginx: configuration file /etc/nginx/conf/nginx.conf test failed

nginx 配置语法正常:nginx: the configuration file /etc/nginx/conf/nginx.conf syntax is ok判断 配置文件没问题;[root@xfg-dev1 lua-cjson-2.1.0]# nginx -tnginx: the configuration file /etc/nginx/conf/nginx.conf syntax is oknginx: configuration file /etc/nginx/conf/ng

2021-01-21 10:28:55 9644

原创 CSRF Failed: CSRF token missing or incorrect

本项目是前后端分离(vue+ Django3)本地测试 Django settings中设置了跨域, post请求没问题;申请了域名 使用nginx正式部署项目后,发现post请求报错:CSRF Failed: CSRF token missing or incorrect问题解析:这是一个django的跨域访问问题。django,会对合法的跨域访问做这样的检验,cookies里面存储的’csrftoken’,和post的header里面的字段”X-CSRFToken’作比较,只有两

2020-12-29 14:02:39 8555 2

原创 Django url末尾斜杆 / 的重定向问题

Django 的配置参数 APPEND_SLASH (布尔值)会自动给网址结尾加斜杆('/').如上图:使用 请求POST /login 301 被重定向到了GET /login/ 405默认地,任何不匹配或尾部没有斜杠(/)的申请URL,将被重定向至尾部包含斜杠的相同字眼的URL。当 seetings.py 设置为 APPEND_SLASH = False 时,访问 POST /login 将会返回 404。注:非GET方法还是不要自动APPEND_SL...

2020-11-04 10:38:40 1957

原创 Ubuntu 安装cjson 编译报错 lua_cjson.c:43:10: fatal error: lua.h

安装cjson的前提的已经安装好了LuaJIT-2.0.4#wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz1、安装cjson#wget -O lua-cjson-2.1.0.tar.gz $download_Url/install/src/lua-cjson-2.1.0.tar.gz -T 20#wget -O https://www.kyne.com.au/~mark/software/download/lua-cjson-2.1..

2020-10-12 17:24:10 1929

原创 Ubuntu安装pure-ftp报错 configure: error: OpenSSL headers not found.

安装pure-ftp报错 configure: error: OpenSSL headers not found.checking for getpwnam_shadow... nochecking whether statvfs64() is defined... yeschecking whether snprintf is C99 conformant... donechecking whether getgroups 0 is sane... yeschecking whether r.

2020-10-12 16:23:32 1372

原创 Ubuntu 20.04 LTS编译安装PHP7.2 报错 configure: error: freetype-config not found

# ln -s /usr/include/freetype2/freetype.sh /usr/include/freetype2/freetype/freetype.h

2020-10-10 13:59:13 6257 3

原创 Django3 部署时访问静态文件

技术环境: python3.8 + centos7 +Django3 + gunicorn + nginx1、settings.py配置:静态文件访问和存放目录STATIC_URL = '/static/'# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/3.1/howto/static-files/# 静态文件设置STATIC_ROOT = BASE_DIR / 'static' #

2020-09-29 14:21:02 1561

原创 maldet --scan-all / 查杀时clamscan 进程CPU占用高处理,cpulimit的使用

maldetect 介绍文档https://github.com/waja/maldetect/blob/master/README修改 maldetect 的配置文件/usr/local/maldetect/conf.maldet ,如下:# Set hard limit on CPU usage for find and clam(d)scan processes. This# requires the 'cpulimit' binary to be available on the s..

2020-09-25 11:28:45 1006

原创 vue.ts + ElementUi Upload上传组件+form表单数据

参考:https://www.cnblogs.com/rxbook/p/11966054.html表单中提交表单数据和上传文件;使用 创建formData对象的方式: <el-form ref="uploadCertificateForm" :model="uploadCertificateForm" :rules="uploadCertificateFormRu...

2020-03-18 17:41:36 709

原创 python3 jwt.decode InvalidSignatureError('Signature verification failed',)

python3 jwt.decode() 报错 InvalidSignatureError('Signature verification failed',)import jwtdata = jwt.decode(encoded_jwt, secret_key, algorithm='HS256')解决:jwt.decode(jwt, key) 的前两个参数 token、秘钥都必须...

2020-01-14 13:48:30 3760

原创 python logging 日志控制台输出和 文件输出

import logginglogger = logging.getLogger()logger.setLevel(logging.INFO) # Log等级总开关log_file_abs = "/tmp/flask.log"stream_handler = logging.StreamHandler() # 日志控制台输出handler = logging.FileH...

2020-01-13 16:26:44 2450

原创 shell 删除旧文件,保留最新n个文件

#!/bin/bash# pg data path /data/postgres# /tmp/test keep 2 filecount1=`ls /tmp/test |wc -l`echo "|------ls /tmp/test |wc -l--count:$count1"if [ $count1 -gt 3 ]; then echo "ls /tmp/tes...

2020-01-10 13:53:29 1614

原创 centos7 安装go环境

方式一、wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gztar -xzvf go1.12.5.linux-amd64.tar.gz -C /usr/local/mkdir -p /home/gopathcat >> /etc/profile <<EOFexport GOROOT=/usr/...

2020-01-07 19:46:18 175

转载 Django Rest Framework API指南

转载:https://www.cnblogs.com/victorwu/p/7418368.htmlDjango Rest Framework 所有API如下:目录一、 请求(Request)二、Response(响应)三、基本视图类 (APIView/@api_view)四、 通用视图(Generic views)五、视图集合ViewSets...

2020-01-02 13:35:44 810

原创 python 异常日志打印

异常日志打印:import logginglogger = logging.getLogger(__name__)# 异常信息打印def except_info(ex, params=None): import sys reload(sys) sys.setdefaultencoding('utf-8') exc_type, exc...

2019-12-31 14:14:50 966 1

原创 Django models 字段重命名、断外键

一、重命名字段名1、创建一个空的migration文件python manage.py makemigrations <app_name> --empty2、 编辑生成的migration文件from django.db import migrationsclass Migration(migrations.Migration): dependen...

2019-12-30 15:07:43 1836

原创 djagno 中拆分App起服务之数据库拆分迁移数据

Django 1.10.2 ,postgresql9.5.51、app服务的代码完整后 ORM关联python manage.py migrate 初始化数据库 创建表可能会报错 ,代码中 models引用问题,先注释掉2、数据迁移导入数据到表中 工具 Navicat12(与有道词典的取词模式不共存)工具 --- >> 数据传输表选项:...

2019-07-16 17:12:47 200

转载 Ubuntu16.04安装Redis

前言Redis是常用基于内存的Key-Value数据库,比Memcache更先进,支持多种数据结构,高效,快速。用Redis可以很轻松解决高并发的数据访问问题;作为实时监控信号处理也非常不错。环境Ubuntu 16.04安装Redis服务器端~ sudo apt-get install redis-server安装完成后,Redis服务器会自动启动,我们检查Redis服务...

2019-07-10 19:59:36 153

原创 Django使用postgresql做数据库 db_index创建索引时会创建第二个索引varchar_pattern_ops问题

例如:minion_id = models.CharField(max_length=100, db_index=True, blank=True, null=False, default="")当字段类型是 models.CharField 或者 models.TextField 时 使用 db_index=True创建索引 会创建第二索引(运算符类postgresql内置的 ...

2019-07-10 15:17:09 1939

原创 Jobtastic 的使用

环境celery(4.0.2)+rabbitmq +redis(3.2.1) +kombu(4.1.0)安装 pip install jobtastic==2.1.1from jobtastic import JobtasticTask"""1、新建一个任务 继承JobtasticTask 类 2、重写def calculate_result(self, **kwargs): ...

2019-07-10 11:36:42 233

转载 Ubuntu 16.04安装MySQL(5.7.18)

转载: https://www.cnblogs.com/jpfss/p/7944622.html此篇为http://www.cnblogs.com/EasonJim/p/7139275.html的分支页。安装MySQL前需要做如下了解:1、MySQL各类型版本的区别,参考:http://www.cnblogs.com/EasonJim/p/6274344.html2、官方的下载地址...

2019-07-05 11:09:34 164

原创 centos7 安装vue

yum install gcc gcc-c++wget https://npm.taobao.org/mirrors/node/v10.15.3/node-v10.15.3-linux-x64.tar.gztar -xvf node-v10.15.3-linux-x64.tar.gzmv node-v10.15.3-linux-x64 node# 修改环境变量vi /etc/p...

2019-07-02 15:07:38 2827 2

原创 centos7 Oracle客户端安装及cx_Oracle安装全过程

-----------------------------------------------------------------------------------------------------------------------******************** *Oracle客户端安装 *...

2019-06-05 14:25:43 1798

转载 pip install cx-Oracle==5.3 distutils.errors.DistutilsSetupError: cannot locate an Oracle software in

Collecting cx-Oracle==5.3 Downloading http://mirrors.aliyun.com/pypi/packages/14/05/4d492fb049eeee24ff8b5fdf23c6240b81ef168d4039dfbf6629e022ba6b/cgz (129kB) 100% |██████████████████████████████...

2019-06-05 13:50:30 1271

转载 ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory

度娘后,发现如下贴子:http://blog.youkuaiyun.com/red10057/article/details/8202255,按照此贴中的步骤,解决了该问题检查which sysresv依赖关系[oracle@RHELDB admin]$ ldd `which sysresv` linux-vdso.so.1 => (0x00007fff42291000)...

2019-06-05 13:44:34 7372

转载 centos7.4 安装 配置Postgresql

参考:https://blog.youkuaiyun.com/rj597306518/article/details/70923630数据库版本: psql (PostgreSQL) 9.6.13安装过程参考官方文档,地址列于此,Linux downloads (Red Hat family) 。CentOS Yum 工具安装,简单方便,查看了一下官方源版本,显示目前最新版本是9.2.15,需要更...

2019-06-04 15:49:42 434

转载 salt api接口python封装

import requestsimport functoolsimport astclass SaltClient(object): auth_token_key = "salt:netapi:auth:token" def __init__(self): self._redis = get_redis_client() # redis 客户端 ...

2019-05-08 20:09:06 353

转载 SaltStack配置salt-api

参考文档 :https://www.jianshu.com/p/012ccdff93cchttp://www.cnblogs.com/xiewenming/p/7716660.htmlhttps://www.jianshu.com/p/02c5286f43c6一,在salt-master上面安装yum -y install salt-api# apt-get in...

2019-05-08 19:40:42 701

原创 Saltstack安装配置

1、master安装及配置yum install salt-master -y在master上修改配置文件(/etc/salt/master)找到以下内容,注释全部去掉,并且注意下面base前面和下一行前面的空格数量,一个为2,一个为4# vim /etc/salt/masterfile_roots: base: - /srv/saltpillar_roots:...

2019-05-07 11:24:31 289

转载 centos6.8 yum安装mysql 5.6 (完整)

一、检查系统是否安装其他版本的MYSQL数据#yum list installed | grep mysql#yum -y remove mysql-libs.x86_64二、安装及配置# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm# rpm -ivh mysql-community...

2019-05-05 09:51:43 94

转载 python创建postgresql数据库

方式1、from sqlalchemy import create_enginefrom sqlalchemy_utils import database_exists, create_database# postgresql 创建数据库user= data["account"]pwd = data["pwd"]host ="w-test.pg.rds.aliyuncs.co...

2019-04-30 17:39:53 1991

原创 python excel 导入导出

导出# Excel 导出class ExportView(View): MyModels = AuthSoft MyFILES = A_S_FILES_MAP NAME = "Test" def get(self, request): try: data = json.loads(request.GET.get("d...

2019-04-26 18:21:34 2032 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除