Note:- with this you don't need to type password every time to do the ssh connection.
ssh-keygen -t rsa
import threading | |
class Thread(threading.Thread): | |
def __init__(self, group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None): | |
threading.Thread.__init__(self, group, target, name, args, kwargs, daemon=daemon) | |
self._return = None | |
def run(self): | |
if self._target is not None: | |
self._return = self._target(*self._args, **self._kwargs) |
# use multiple gpu devices by index | |
import os | |
#GPU_id = '0' | |
GPU_id = '0,1,2,3' | |
os.environ['CUDA_VISIBLE_DEVICES'] = GPU_id |
import os | |
import cv2 | |
import hashlib | |
import numpy as np | |
import scipy.fftpack | |
class HashEngine: | |
def __init__(self, htype="dhash", hash_size=8): | |
self.hash_size = hash_size | |
self.htype = htype |
# make sure terminal window is active when pressing any key | |
import cv2 | |
import numpy as np | |
import time | |
from waitKey import waitKey | |
frame = np.zeros((300, 300, 3)) | |
idx, st = 0, time.time() | |
while True: |
# https://github.com/linghu8812/blur_detector/blob/master/blur_detector.py | |
import cv2 | |
import numpy as np | |
class BlurDetector(object): | |
def __init__(self): | |
"""Initialize a DCT based blur detector""" |
# https://github.com/yogin16/prototxt_parser | |
# pip install parsy==1.3.0 | |
from parsy import generate, regex, string | |
# Convert an array of tuples array [[(a,b),(a,c)]] to an object {a: [b,c]} | |
def tuples_to_dict(a): | |
# print(a) | |
new_dict = {} | |
for tuples in a: |
1. Stop the docker daemon
sudo service docker stop
2. Add a configuration file to tell the docker daemon what is the location of the data directory
Using your preferred text editor add a file named daemon.json
under the directory /etc/docker
.
sudo vim /etc/docker/daemon.json
import random | |
import colorsys | |
def generate_colors(n): | |
random.seed(10101) | |
hsv_tuples = [(x / n, 1., 1.) for x in range(n)] | |
colors = list(map(lambda x: colorsys.hsv_to_rgb(*x), hsv_tuples)) | |
colors = list(map(lambda x: (int(x[0] * 255), int(x[1] * 255), int(x[2] * 255)), colors)) | |
random.shuffle(colors) | |
random.seed(None) |
# https://stackoverflow.com/questions/59025321/capture-jpeg-images-from-rtsp-gstreamer | |
gst-launch-1.0 rtspsrc location="rtsp://admin:123456@192.168.0.123/stream0" num-buffers=1 \ | |
! rtph264depay ! avdec_h264 \ | |
! nvjpegenc ! multifilesink location="./frame.jpg" |