用openresty开发Nginx插件
摘要:OpenResty的优势 首先我们选择使用OpenResty,其是由Nginx核心加很多第三方模块组成,其最大的亮点是默认集成了Lua开发环境,使得Nginx可以作为一个Web Server使用。 借助于Nginx的事件驱动模型和非阻塞IO,可以实现高性能的Web应用程序。 而且OpenResty提
阅读全文
压缩和解压安装包
摘要:# coding: utf-8 import os import sys import tarfile import zipfile import re import platform def get_pkgname(tar_name): ends = ['.tar.gz', '.tar', '.gz', '.gz2', '.bz', '.bz2', '-win32.zip', '-...
阅读全文
用salt一键编译安装nginx
摘要:# -*- coding: utf-8 -*- ''' Support for Nginx This module uses the manager webapp to manage Apache Nginx webapps. If the manager webapp is not configured some of the functions won't work. :configura...
阅读全文
一键安装activemq
摘要:# -*- coding: utf-8 -*- """ Support for Activemq This module uses the manager webapp to manage Activemq. If the manager Activemq is not configured some of the functions won't work. :configuration: ...
阅读全文
阿里云api调用
摘要:# coding: utf-8"""This module be able to manage ecs instances on the aliyun cloud. We choosesome helper functions from salt.cloud.clouds.aliyun since
阅读全文
mysql高可用-双主热备Keepalived+Mysql
摘要:1、配置两台Mysql主主同步 [root@master ~]# yum install mysql-server mysql -y [root@master ~]# service mysqld start [root@master ~]# mysqladmin -u root password
阅读全文
mysql根据单个值剔除重复数据
摘要:DELETE FROM dashboard_issues WHERE id NOT IN (SELECT temp.min_id FROM (SELECT MAX(id) min_id FROM dashboard_issues GROUP BY code )AS temp); 把数据库:test(
阅读全文
easyStack开发
摘要:接口参考openstack文档启动虚拟机 def start_vm_new(openstack_auth=None, user_auth=None,vm_info=None, project_info=None,region=None,**kwargs): try: data = {"os-start": None} vmid = getopenstack...
阅读全文
腾讯云创建虚拟机
摘要:# -*- coding: utf-8 -*- from tencentcloud.common import credential from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException from tencentcloud.cvm.v20170312 impo...
阅读全文
oracle单机部署
摘要:chown -R oracle:oinstall /opt/databasechmod -R 755 /opt/database su - oracle <<!/opt/database/runInstaller -silent -responseFile /home/oracle/enterpri
阅读全文
ssh多机互信
摘要:#!/bin/bash os_user= os_password= hosts=' '#多个ip用空格分隔 id $os_user >/dev/null || exit 1 #获取用户家目录 user_home=$(grep -w $os_user /etc/passwd |cut -d : -f 6) # 生成ssh从stdin读取免密的脚本 cat > /tmp/pass /de...
阅读全文
金山云开发
摘要:安装sdk import os import zipfile import commands cmd='cd {};cd ksc-sdk-python-master;{} setup.py install'.format(dst_dir,python_path) print cmd res=commands.getstatusoutput(cmd) if res[0]: print re...
阅读全文
交换机巡检和监控
摘要:# coding=utf8 import json import sys from concurrent.futures import ThreadPoolExecutor def patrol(input_keys): host = input_keys['host'] username = input_keys['username'] password = in...
阅读全文
交换机配置文件备份
摘要:# coding: UTF-8 import os import time from concurrent import futures HEADERS = { 'Content-Type': 'application/json', 'Accept': 'application/json', } def connect(host, username, password, *...
阅读全文
openstack各类操作
摘要:#coding=utf8 import json import re import requests class ExecError(Exception): pass class ServerAction(object): def __init__(self,openstack_auth,vm_info=None,volume_info=None): #ope...
阅读全文
添加DNS,yum源并更新
摘要:echo "nameserver 8.8.8.8">>/etc/resolv.conf mkdir -p /tmp/bak/ mv -f /etc/yum.repos.d/* /tmp/bak/ cat >/etc/yum.repos.d/CentOS6.repo <<EOF # CentOS-Base.repo # # The mirror system uses the connecting...
阅读全文
用saltstack命令下发文件
摘要:#coding = utf8 import shutil import sys import os import subprocess proxy_path = sys.executable.split('embedded')[0] cache_dir = os.path.normpath(os.path.join(proxy_path, 'scripts', 'script')) conf_...
阅读全文
华为云各类操作
摘要:删除云服务器# coding: utf8 import json import re import requests import sys class ExecError(Exception): pass class ServerAction(object): def __init__(self, openstack_auth, user, password, proje...
阅读全文
从FTP获取文件并恢复网络设备
摘要:#coding=utf8 import paramiko import sys import time import os import re class DoError(Exception): pass class DoSsh(object): def __init__(self,host=None, username=None, password=None, port...
阅读全文
weblogic监控
摘要:connect('user', 'password', 't3://xx.xx.xx.xx:7001') def report_format(code, name, result, alert=0, children=None): _report_ = {'code': code, 'name': name, 'result': result, 'alert': alert} ...
阅读全文
打包压缩maven库
摘要:#coding=utf8import osimport shutilimport timeimport ftplibimport sysimport subprocessimport tarfileimport datetimeimport smtplibfrom email.mime.text i
阅读全文
解决vsftp无法上传文件及文件夹的问题
摘要:windows使用FileZilla连接linux的ftp,比较郁闷的是上传问题,弄了半个下午的时间都没有成功,刚刚终于弄好了。。下面说一下思路: 1、安装vsftp yum install vsftp 2、启动vsftp service vsftpd start 虽然可以正确启动,基本都是按照默认
阅读全文
Ansible之Playbook详解、案例
摘要:playbooks是 一个不同于使用Ansible命令行执行方式的模式,其功能更强大灵活。简单来说,playbook是一个非常简单的配置管理和多主机部署系统,不同于任何已经存在的模式,可作为一个适合部署复杂应用程序的基础。Playbook可以定制配置,可以按照指定的操作步骤有序执行,支持同步和异步方
阅读全文
python解压分析jar包
摘要:import osimport shutilimport zipfile count = 1def getSumDir(): sumfilelist = os.listdir(os.getcwd()) for dir in sumfilelist: if ".idea" not in dir: cl
阅读全文
owasp对项目依赖的jar包安全扫描
摘要:一、什么是owasp OWASP,全称是:Open Web Application Security Project,翻译为中文就是:开放式Web应用程序安全项目,是一个非营利组织,不附属于任何企业或财团,这也是该组织可以不受商业控制地进行安全开发及安全普及的重要原因,详细的介绍可以参见下方Wiki
阅读全文
jenkins的api
摘要:pip install python-jenkins https://pypi.org/project/python-jenkins/ https://www.cnblogs.com/znicy/p/5498609.html 查找python项目依赖并生成requirements.txt 使用pip
阅读全文
python websocket服务
摘要:WebSocket 是一个标准化协议,构建在 TCP 之上,能够在客户端和服务端之间建立一个全双工的通信渠道。这里的客户端和服务端通常是用户浏览器和 Web 服务器。在 WebSocket 诞生之前,如果我们想保持这样的一个长连接,就需要使用诸如长轮询、永久帧、Comet 等技术。而现今 WebSo
阅读全文
django crontab定时执行任务
摘要:安装 pip install django-crontab 安装 pip install django-crontab 安装 pip install django-crontab 安装 pip install django-crontab 添加app名称到 settings.py中 INSTALLE
阅读全文
mongoDB查询方式
摘要:/ 1. 登录到 mongoDB 所在服务器,如果是集群情况,为减轻数据库的压力,可以在从节点执行 // 2、cd 到 mongodb 的 bin 目录,连接数据库(用户名和密码可能需要调整)cd /opt/mongodb/bin./mongo -u {}-p {}--authenticationD
阅读全文
js动态生成下拉列表
摘要:<html><head><script> var arrayNation = new Array('汉族','蒙古族','彝族','侗族','哈萨克族'); var arrayDegree = new Array('小学','初中','高中','中专','大专','本科','硕士','博士'); f
阅读全文
python编写websocket长连接
摘要:from websocket import create_connectionws = create_connection("wss://ws.xxxxxxx.info/inv")ws.send(str({"op":"unconfirmed_sub"}))print("Receiving...")r
阅读全文
解决Django+nginx时Admin页面样式丢失问题和模板丢失问题
摘要:比如说界面变成了这样: 解决办法: 1、在服务器上打开python,然后imort django ,print django.__file__查看django包的目录路径,然后在settings.py的路径里加上admin的static文件的路径 2、修改settings.py中STATIC_ROO
阅读全文
高并发参考toutube
摘要:YouTube发展迅速,每天超过1亿的视频点击量,但只有很少人在维护站点和确保伸缩性。平台 Apache Python Linux(SuSe) MySQL psyco,一个动态的Python到C的编译器 lighttpd代替Apache做视频查看状态 支持每天超过1亿的视频点击量 成立于2005年2
阅读全文
nginx + uWSGI 提高 Django的并发性
摘要:1. uWSGI : uWSGI是一个web服务器,实现了WSGI协议、uwsgi协议、http协议等。 uWSGI的主要特点是: 超快的性能 低内存占用 多app管理 详尽的日志功能(可以用来分析app的性能和瓶颈) 高度可定制(内存大小限制,服务一定次数后重启等) uWSGI服务器自己实现了基于
阅读全文