Skip to content

Instantly share code, notes, and snippets.

View dsdanielpark's full-sized avatar
🏄‍♂️
Believe in your potential. May the Force be with us.

MinWoo(Daniel) Park dsdanielpark

🏄‍♂️
Believe in your potential. May the Force be with us.
View GitHub Profile
@dsdanielpark
dsdanielpark / deskew.py
Created June 21, 2022 00:16 — forked from russss/deskew.py
Automatic scanned image rotation/deskew with OpenCV
import cv2
import numpy as np
def deskew(im, max_skew=10):
height, width = im.shape
# Create a grayscale image and denoise it
im_gs = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
im_gs = cv2.fastNlMeansDenoising(im_gs, h=3)
@dsdanielpark
dsdanielpark / pypi_release.md
Last active March 7, 2023 06:43
pypi_release
python -m pip install poetry
poetry new quick-show
poetry publish --build

cd .github/workflows/publish.yml


python -m pip install build
python -m build

git-lfs

What is git-lfs??

git-lfs is kinda of pointer hash which has infomation about file address of cloud data stroage.

  • You can uploade and manage revision of large file (>100MB)
  • git-lfs give you 1GB for free, and you can upload 1.5GB (If you use over 1.5GB, git-lfs will be locked until you pay for it.)

For more infomations
[1] https://git-lfs.com/
[2] http://arfc.github.io/manual/guides/git-lfs
@dsdanielpark
dsdanielpark / gist:8377f2f7db73a1d6252a6f1b157964d2
Created March 2, 2023 03:52
ValueError: attempted relative import beyond top-level package
import sys
from pathlib import Path
file = Path(__file__).resolve()
package_root_directory = file.parents[1]
sys.path.append(str(package_root_directory))
@dsdanielpark
dsdanielpark / diagram.md
Last active April 11, 2023 13:43
UML class diagram and packages diagram
@dsdanielpark
dsdanielpark / ipykernel.md
Last active March 7, 2023 06:43
ipykernel install
python -m ipykernel install --user --name myvenv --display-name myvenv

poetry init

poetry add [django]

poetry build

@dsdanielpark
dsdanielpark / vram.md
Last active March 27, 2023 14:02
When you need to clean vram cache
import gc
gc.collect()

import torch
torch.cuda.empty_cache()

tf.keras.backend.clear_session()
@dsdanielpark
dsdanielpark / convert.md
Created April 6, 2023 08:19
Converting String-formatted Arrays Back to Array Objects in Multidimensional Embedded Arrays from CSV Files

When a multidimensional embedded array is saved as a string in a CSV file, you can load it back and convert the string-formatted array into an array object.

def convert(item):
    item = item.strip()  
    item = item[1:-1]   
    item = np.fromstring(item, sep=' ') 
    return item