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
@ryul99
ryul99 / anywait.sh
Created August 10, 2023 07:03
wait function for any pid without see "pid is not a child of this shell"
#!/usr/bin/env bash
# https://unix.stackexchange.com/a/427133
if [ `uname` == "Linux" ]; then
tail --pid=$1 -f /dev/null
else
lsof -p $1 +r 1 &>/dev/null
fi
@ryul99
ryul99 / rclone-install.sh
Created April 8, 2023 12:05
rclone installer without sudo
#!/usr/bin/env bash
# Origin code: https://rclone.org/install.sh
# error codes
# 0 - exited without problems
# 1 - parameters not supported were used or some unexpected error occurred
# 2 - OS not supported by this script
# 3 - installed version of rclone is up to date
# 4 - supported unzip tools are not available
@ryul99
ryul99 / btop-installer.sh
Last active April 8, 2023 12:09
btop download bash script
!#/bin/bash
set -e
TMP_BTOP_DIR="/tmp/$USER/btop/"
mkdir -p $TMP_BTOP_DIR
cd $TMP_BTOP_DIR
curl --remote-name-all -o "$TMP_BTOP_DIR/btop.tbz" --location $( \
curl -s https://api.github.com/repos/aristocratos/btop/releases/latest \
| grep "browser_download_url.*$(uname -m)-linux.*" \
| cut -d : -f 2,3 \
@ryul99
ryul99 / DDP.py
Last active November 3, 2022 20:42
Hydra DDP test
import logging
import os
import hydra
import torch
import datetime
import torch.distributed as dist
import torch.multiprocessing as mp
from omegaconf import OmegaConf
@ryul99
ryul99 / write_text_to_image.py
Created May 18, 2020 07:55
write text to image with PILLOW
import glob
from PIL import ImageFont, ImageDraw, Image
from multiprocessing import Pool
from functools import partial
import random
import tqdm
def imwrite(input_, save_dir):
i, data = input_
@ryul99
ryul99 / test_gaussian_noise.py
Last active April 23, 2020 05:35
testing gaussian noise
# made by @mori_inj
import numpy as np
import matplotlib.pyplot as plt
import cv2
p = 2#np.inf
pert = 100#1000
im = cv2.imread('00000000.png')
#print(type(im)) # 처음부터 numpy
#print(im.shape) # (H, W, C)
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
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
@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'
@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