原创 docker容器時間修改

# 直接在docker容器裏面通過date -s的方式修改會影響外部服務器時間 # 採用faketime只能欺騙應用 # date -s 不生效 ==> sudo timedatectl set-ntp false

原创 Ubuntu 16.04 搭建rtsp服務

GitHub源碼:https://github.com/EasyDarwin/EasyDarwin https://github.com/EasyDarwin/EasyDarwin/releases ! 僅支持amd平臺架構,可docker

原创 Django配置websocket

# setting.py 配置 INSTALLED_APPS = [ '···', 'channels', '···', ] ASGI_APPLICATION = 'face_safe.asgi.applicati

原创 ffmpeg 轉碼MP4/ogg/webm

ffmpeg 轉 MP4 ffmpeg -fflags genpts -threads 12 -an -i stream.tmp -preset ultrafast -tune fastdecode -crf 25 -r 25 -s 960

原创 websocket or HTTP???

發現了一個問題,簡單記錄一下:1. Django後端實現一個FIFO的消息隊列 2. 通過HTTP寫入正常 3. 通過HTTP讀取正常   1. 通過HTTP寫入正常 2. 通過websocket讀取爲None 3. 再次通過HTTP讀取正

原创 Queue-FIFO

import random import threading from datetime import datetime from queue import Queue class SingletonType: _instanc

原创 內網穿透-frp

選擇適合自己版本的frp版本 選擇適合自己的frp版本 https://github.com/fatedier/frp/releases wget https://github.com/fatedier/frp/releases/down

原创 docker-compose Yapi、Gogs

version: '3' services: yapi-web: image: nightz/yapi:latest container_name: yapi-web restart: always p

原创 is_valid重寫。返回數據格式統一

def is_valid(self, raise_exception=False): assert hasattr(self, 'initial_data'), ( 'Cannot call

原创 django-序列化參數爲空報錯問題

# 問題的起因是我後端設置如果參數爲空不傳。結果前端傳給我空字符串。遂二次處理。 def create(self, request, *args, **kwargs): try: reques

原创 單文件日誌測試

LOG_NAME = os.path.join(BASE_DIR, 'logs', 'script_import.log')class Logger(object): level_relations = { 'de

原创 python生成國內隨機ip

import random import string def get_ip(): ips = ['58.14.0.0', '58.16.0.0', '58.24.0.0', '58.30.0.0', '58.32.0.0',

原创 模塊動態導入

# def module_resolver(namespace): # namespace_parts = namespace.split(".") # module_name = ".".join(namespace_p

原创 python質數因式分解

# 質數因式分解 import math x = int(input("請輸入一個大於10的整數:")) primes = [p for p in range(2, x // 2 + 1) if 0 not in [p % d for

原创 Ubuntu18.04-docker-compose安裝

root@iZm5e85x7l9b634qjg73hsZ:~# history 1 ls 2 sudo apt-get update 3 sudo apt-get install apt-transport-