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 threading import Thread | |
import cv2 | |
def connect(user, pwd, ip="192.168.0.1", port=88): | |
cap = cv2.VideoCapture('rtsp://%s:%s@%s:%d/videoMain' % (user, pwd, ip, port)) | |
while True: | |
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
import hashlib | |
from glob import glob | |
import os | |
import cv2 | |
import subprocess | |
def md5_for_file(path): | |
with open(path, 'rb') as f: | |
md5 = hashlib.md5() |
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 fitz # pip install pymupdf | |
pdffile = "file.pdf" | |
doc = fitz.open(pdffile) | |
for i in range(doc.pageCount): | |
page = doc.loadPage(i) | |
zoom = 5 | |
pix = page.getPixmap(matrix=fitz.Matrix(zoom, zoom)) | |
output = "file_%d.png" % i | |
pix.writePNG(output) |
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
|46281 |42655 |1794 |ultrabrite | |sewers of d'oh! | |
|nightride-0 |nightride |1794 |vladcom | |night ride | |
|toyrogue-0 |toyrogue |1794 |extar | |toyrogue 1.0 | |
|metrash-2 |metrash |1794 |st33d | |metrash | |
|pakpok-0 |pakpok |1794 |st33d | |pakpok | |
|cgprospector-0 |cgprospector |1794 |st33d | |cgprospector | |
|celeste_classic_2-5 |celeste_classic_2 |1794 |noel | |celeste classic 2 | |
|dollarone_nightatthemuseum-0 |dollarone_nightatthemuseum |1794 |dollarone | |dollarone_nightatthemuseum | |
|picpots-0 |picpots |1794 |enrohk | |picpots | |
|flipknight-0 |flipknight |1794 |
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 json | |
import os | |
import pickle | |
import random | |
import uuid | |
class PersistentClass: | |
reserved_keys = ["__dict__", "filename", "debug", "autosave", "file_ext"] |
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 pymouse import PyMouse | |
import time | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
btn_up = 5 | |
btn_down = 26 | |
btn_left = 19 | |
btn_right = 6 |
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
sudo apt-get install cmake | |
cd ~ | |
#git clone https://github.com/juj/fbcp-ili9341.git # original repo | |
git clone https://github.com/badjano/fbcp-ili9341 # my modified repo for square screen cropping | |
cd fbcp-ili9341 | |
mkdir build | |
cd build | |
cmake --clean-first -DSPI_BUS_CLOCK_DIVISOR=20 -DWAVESHARE_ST7735S_HAT=ON -DDMA_TX_CHANNEL=7 -DDMA_RX_CHANNEL=1 -DBACKLIGHT_CONTROL=OFF -DDISPLAY_BREAK_ASPECT_RATIO_WHEN_SCALING=ON -DSTATISTICS=0 .. | |
make -j | |
sudo install ./fbcp-ili9341 /usr/local/bin/fbcp |
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 numpy as np | |
from PIL import Image | |
arr = np.random.rand(256, 256, 4) * 255 | |
img = Image.fromarray(arr.astype('uint8'), mode="RGBA") | |
img.save("random_img.png") | |
img.show() |
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 datetime | |
class Range: | |
def __init__(self, start, end): | |
self.start = min(start, end) | |
self.end = max(start, end) | |
self.empty = self.start == self.end | |
self.log = False |
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 numpy as np | |
import cv2 | |
from PIL import ImageGrab | |
from screeninfo import get_monitors | |
monitors = [] | |
for m in get_monitors(): | |
monitors.append((m.x, m.y, m.x + m.width, m.y + m.height)) | |
bbox = monitors[0] |