01 2021 档案
摘要:示例 import pandas as pd data_list = [ {'tier_1': 'alpha', 'tier_2': 'do', 'tier_3': 'copy', 'department': 'AAA'}, {'tier_1': 'alpha', 'tier_2': 'thing'
阅读全文
摘要:helper.py 包含外键关联跳转、model对象拷贝、模型字段自定义校验的部分通用函数 from django.utils.safestring import mark_safe from copy import deepcopy from django.utils.translation im
阅读全文
摘要:settings.py 配置以下变量,参与AD认证 AUTH_LDAP_SERVER_URI = 'ldap://10.108.198.6:389' AUTH_LDAP_BIND_DN = 'CN=test,OU=Service Accounts,DC=lenovo,dc=com' AUTH_LDA
阅读全文
摘要:内置函数相互转换: SELECT TO_DAYS('2021-01-01'); SELECT FROM_DAYS(738162); 创建分区表示例 CREATE TABLE IF NOT EXISTS `{tb_name}` ( `id` int(11) NOT NULL AUTO_INCREMEN
阅读全文
摘要:查询分区表 SELECT nmsp_parent.nspname AS parent_schema, parent.relname AS parent, nmsp_child.nspname AS child_schema, child.relname AS child, child.oid AS
阅读全文
摘要:wget https://www.python.org/ftp/python/3.7.7/Python-3.7.7.tgz tar -xvzf Python-3.7.7.tgz cd Python-3.7.7 sudo su ./configure --prefix=/usr/local/pytho
阅读全文
摘要:nginx.conf 包含子目录配置 # Load dynamic modules. See /usr/share/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1
阅读全文
摘要:1 import time 2 import os 3 from pyvirtualdisplay import Display 4 from selenium import webdriver 5 6 DOMAIN = 'http://127.0.0.1:8000' # Use flask as
阅读全文
摘要:经测试可安装以下包 1 sudo su 2 3 yum install ksh -y 4 yum install libXext.so.6 -y 5 yum install libXtst.so.6 –y 6 yum install libXt.so.6 -y 7 yum install libGL
阅读全文
摘要:设置最大并发限制65535 1 sudo su 2 vi /etc/security/limits.conf 3 * soft nofile 65535 4 * hard nofile 65535 5 * soft nproc 65535 6 * hard nproc 65535 7 8 vi /e
阅读全文
摘要:1 import datetime 2 3 4 def get_next_month(date_t: datetime.date) -> datetime.date: 5 """ 6 :param date_t: datetime.date or datetime.datetime -> 2020-
阅读全文
摘要:1 <script> 2 let post_data = {ids: [1, 2, 3]} 3 try { 4 $.ajax({ 5 type: 'POST', 6 url: 'url', 7 async: false, // false: 同步请求, true: 异步请求 8 data: post
阅读全文
摘要:pxgrid.py import requests import urllib3 import os import sys import json import websockets import asyncio from io import StringIO from base64 import
阅读全文
摘要:1 <input id='search' type="text" placeholder="Search..."> 2 <table id="downloads" class="table table-bordered table-hover" style="width:100%"> 3 <scri
阅读全文
摘要:1 function parseUrlParams(json_data) { 2 var tempArr = []; 3 try { 4 for (let k in json_data) { 5 let key = encodeURIComponent(k); 6 let value = encod
阅读全文
摘要:def sort_choices(choices, reverse=False, v1_funcs=None, v2_funcs=None): """ :param choices: (('a', 'hello'), ('b', 'world'), ) :param reverse: True or
阅读全文
摘要:import requests import json import sys import os class ZabbixAPI(object): # https://www.zabbix.com/documentation/5.0/manual/api/reference/hostgroup/ge
阅读全文
摘要:import requests import json class SDWanRestAPI(object): def __init__(self, v_manage_ip, username, password): self.v_manage_ip = v_manage_ip self.cooki
阅读全文
摘要:1 import requests 2 import os 3 import urllib.parse 4 import xmltodict 5 6 7 class AirWaveAPI(object): 8 """Aruba networks AirWave API client. 9 Attri
阅读全文
摘要:import datetime import socket import json import re from OpenSSL import SSL import logging """ pip install pyOpenSSL """ def choice2dict(choices): """
阅读全文
摘要:1 from Crypto.Cipher import AES 2 from binascii import b2a_hex, a2b_hex 3 4 """ 5 pip install pycryptodome 6 """ 7 8 9 class Cipher(object): 10 MODE =
阅读全文
摘要:import pymysql import psycopg2.extras import pymssql import logging class DBMS(object): """ The context manager has been implemented, Can be modified
阅读全文
摘要:import ldap3 AD_USER_PROPERTIES = [ 'userPrincipalName', 'department', 'sn', 'physicalDeliveryOfficeName', 'msExchOWAPolicy', 'lastLogonTimestamp', 'm
阅读全文
摘要:1 from ftplib import FTP 2 3 4 class FtpManager(object): 5 def __init__(self, host: str, username: str, password: str, port: int = 21): 6 self.ftp = F
阅读全文
摘要:关于json.dumps出现datetime, tuple等问题,reids读取数据出现bytes等问题,可用代码中的例进行改善 1 import datetime 2 3 4 class DataConverter(object): 5 def __init__(self, data: (list
阅读全文
摘要:1 from jira import JIRA 2 from jira.resources import Issue 3 import datetime 4 5 """ 6 pip install jira 7 """ 8 9 10 class JIRATool(object): 11 def __
阅读全文
摘要:1 import requests 2 3 4 class NetFlow(object): 5 def __init__(self, domain: str, api_key: str): 6 """ 7 :param domain: https://netflow.lenovo.com or h
阅读全文
摘要:1 import datetime 2 import time 3 import logging 4 5 import requests 6 7 8 class PaloAltoFirewallAPI(object): 9 error_codes = { 10 '400': 'Bad request
阅读全文
摘要:1 import codecs 2 from django.shortcuts import HttpResponse 3 4 5 def csv_response(data_list: [tuple, tuple, ...], filename: str): 6 """ 7 :param data
阅读全文
摘要:1 import gitlab 2 3 """ 4 pip install python-gitlab 5 """ 6 7 8 class Gitlab(object): 9 def __init__(self, url: str, private_token: str, project_id: i
阅读全文

浙公网安备 33010602011771号