Skip to content

Instantly share code, notes, and snippets.

View ryul99's full-sized avatar
😺
Lovely Kitten!

Changmin Choi ryul99

😺
Lovely Kitten!
View GitHub Profile
### Keybase proof
I hereby claim:
* I am ryul99 on github.
* I am ryul_99 (https://keybase.io/ryul_99) on keybase.
* I have a public key ASB5_1TIxA35iojFpDcBd5QKuL6QN4Ry-pJ9fgJyb0mQBAo
To claim this, I am signing this object:
@ryul99
ryul99 / keybase.md
Created August 17, 2018 12:35
keybase.md

Keybase proof

I hereby claim:

  • I am ryul99 on github.
  • I am ryul_99 (https://keybase.io/ryul_99) on keybase.
  • I have a public key whose fingerprint is A18B E3FE DDCF D4F9 BC46 D696 C1C3 4851 BA8B 6E67

To claim this, I am signing this object:

@ryul99
ryul99 / docker_descendants_pids.sh
Created July 11, 2019 07:21
get pids of descendants processes of docker container and itself
#!/bin/bash
# get docker container self and descendants pids
docker_container_pids=()
docker_container_descendants=()
for container_id in $(docker ps --format '{{.ID}}'); do
a=$(docker inspect -f '{{.State.Pid}}' "$container_id")
docker_container_pids+=( "$a" )
done
for pid in ${docker_container_pids[@]}; do
# made by ryul99 at github
from bs4 import BeautifulSoup
import requests
from tqdm import tqdm
paper_index_page = 'whole url of NeaurIPS paper list page'
print('Crawling Paper List...')
req = requests.get(paper_index_page)
html = req.text
@ryul99
ryul99 / large_file_downloader.py
Created December 24, 2019 06:39
download large size file from web
import requests, sys
from tqdm import tqdm
def download_file(url, local_filename):
# NOTE the stream=True parameter below
with requests.get(url, stream=True) as r:
r.raise_for_status()
with open(local_filename, 'wb') as f:
for chunk in tqdm(r.iter_content(chunk_size=8192)):
if chunk: # filter out keep-alive new chunks
@ryul99
ryul99 / get_lines.py
Created April 9, 2020 05:40
Line Detection with opencv
def get_lines(img_path): # return: [[left, top, right, bottom]...]
img = cv2.imread(img_path)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,150,apertureSize = 3)
minLineLength = 100
maxLineGap = 10
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength,maxLineGap)
return lines
@ryul99
ryul99 / assemble_image.py
Last active May 23, 2021 14:42
Split big image with python. You can split with split_image.py, assemble with assemble_image.py
# assemble images which is splited by split_image.py
import cv2
import glob
import os
import tqdm
import numpy as np
from itertools import islice
from multiprocessing import Pool
@ryul99
ryul99 / pad_image.py
Created April 9, 2020 05:57
Padding Image with Python
import cv2
import glob
import os
import tqdm
from itertools import islice
from multiprocessing import Pool
import numpy as np
from pathlib import Path
path = r'/path/to/image/*.png'
import cv2
import glob
import os
import tqdm
from itertools import islice
from multiprocessing import Pool
from pathlib import Path
path = r'./**/*.png'
resize_factor = (0.5, 0.5) # Width, Height
import cv2
import glob
import os
import tqdm
from itertools import islice
from multiprocessing import Pool
from pathlib import Path
path = r'D:\Google Drive(SNU)\Study\Dataset\EDVR\Inference\dance_1080_120fs\dance_4k_60fps_downscaled\*.png'
img_size = [(1080, 2048,3)] # Width, Height