Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Prayson Wilfred Daniel Proteusiq

🎯
Focusing
  • Copenhagen, DK
View GitHub Profile
View images_to_pdf.py
from pathlib import Path
from PIL import Image
# get all png images from folder `gotoslides`
SLIDES_IMAGES = Path("gotoslides").glob("*.png")
# maybe use a generator | convert RGB (since its png)
images = [Image.open(image).convert("RGB") for image in SLIDES_IMAGES]
with open("gotoslides.pdf", "wb") as pdf_file:
View pd_conventers.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View get_pdf.py
# Using pyPDF2 and requests(or httpx) to extract PDF data
import io
import requests
import PyPDF2
# my favorite Kierkegard's PDF book
URI = "https://antilogicalism.com/wp-content/uploads/2017/07/thesicknessuntodeath.pdf"
headers = {"user-agent": "Prayson W. Daniel: prayson*at*.com"}
View goodread.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View SMA.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View everything_conda.md
View compress_csv.py
from pathlib import Path
import pandas as pd
DATA_FOLDER = Path("data")
# get all csv files in data and its subfolders
for csv_file in DATA_FOLDER.rglob("*.csv"):
csv_full_path = csv_file.resolve()
View pipelines_ray.py
import time
from functools import wraps
from pathlib import Path
from typing import Callable, Optional, Union
import numpy as np
import pandas as pd
import ray
def pipeline_logger(function: Callable):
View camera_intel.py
import torch
import cv2
from tags import label_bbbox
model = torch.hub.load("ultralytics/yolov5", "yolov5s", pretrained=True, classes=80)
model.conf = 0.75
capture = cv2.VideoCapture(0)
assert capture.isOpened(), "Cannot open camera"
View tags.py
from bounding_box import bounding_box as bb
names = [
"person",
"bicycle",
"car",
"motorcycle",
"airplane",
"bus",