This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import subprocess | |
import logging | |
fmt = "%(asctime)-15s %(levelname)s %(filename)s %(lineno)d %(process)d %(message)s" | |
datefmt = "%a %d %b %Y %H:%M:%S" | |
logging.basicConfig(format=fmt, datefmt=datefmt, level=logging.INFO) | |
def ipset_basic_struct(action, ipset_name, ip): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyvirtualdisplay import Display | |
from selenium import webdriver | |
import os | |
display = Display(visible=0, size=(1024, 768)) | |
# display port ,exmaple :1001 | |
displayport = display.display | |
os.environ["DISPLAY"] = displayport | |
display.start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td class="autocut"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Strip comments and docstrings from a file. | |
""" | |
import sys, token, tokenize | |
def do_file(fname): | |
""" Run on just one file. | |
""" | |
source = open(fname) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import collections | |
import threading | |
import time | |
import random | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gevent | |
import gevent.server | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import socket | |
import string | |
import random | |
import filecmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.7.9-slim-buster as base | |
WORKDIR /wheels | |
COPY ./requirements.txt . | |
RUN apt-get update && \ | |
apt-get install -y \ | |
default-libmysqlclient-dev \ | |
libmariadb3 \ | |
gcc | |
RUN pip install -U pip \ | |
&& pip install --no-cache-dir wheel \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:2.7.18-slim-stretch as base | |
WORKDIR /wheels | |
COPY ./requirements.txt . | |
RUN apt-get update && \ | |
apt-get install -y \ | |
default-libmysqlclient-dev \ | |
libmariadbclient18 \ | |
gcc | |
RUN pip install -U pip \ | |
&& pip install --no-cache-dir wheel \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
""" | |
Python 验证码生成封装 | |
生产环境使用NO POLT模式,单次耗时100ms左右。 | |
2020-12-04 | |
""" | |
from captcha.image import ImageCaptcha |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: python -*- | |
block_cipher = None | |
a = Analysis(['myproject\\manage.py'], | |
pathex=['D:\\GitHub\\django_samples\\django_pyinstaller_sample'], | |
binaries=[], | |
datas=[ | |
('myproject/templates', 'templates'), |
OlderNewer