Skip to content

Instantly share code, notes, and snippets.

View joonas-yoon's full-sized avatar
🎃
Focusing

Joona Yoon joonas-yoon

🎃
Focusing
View GitHub Profile
# %%
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
# %%
@joonas-yoon
joonas-yoon / benchmark.py
Last active January 30, 2023 08:01
jad vs. pandas
import time
import json_as_db as jad
import pandas as pd
from tqdm import tqdm
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
def measure(func):
@joonas-yoon
joonas-yoon / intellij-java-google-style.xml
Created August 8, 2022 05:12
Forked from Google Java Style Guide
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleStyle">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@joonas-yoon
joonas-yoon / defaultLifecycleTest.java
Created July 27, 2022 06:33
JUnit Lifecycle Test
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class LifeCycleTest {
private int count = 0;
LifeCycleTest() {
System.out.println("construct");
}
import os
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from tqdm import tqdm
def file_list(path):
return list(map(lambda s: os.path.join(path, s), os.listdir(path)))
@joonas-yoon
joonas-yoon / autoencoder.py
Created May 31, 2022 10:30
MNIST AutoEncoder
class AutoEncoder(nn.Module):
def __init__(self):
super().__init__()
self.encoder = nn.Sequential(
nn.Conv2d(1, 32, 3, padding=1),
nn.ReLU(),
nn.Conv2d(32, 64, 3, padding=1, stride=2),
nn.ReLU(),
nn.Conv2d(64, 64, 3, padding=1, stride=2),
nn.ReLU(),
@joonas-yoon
joonas-yoon / gen.py
Created April 24, 2022 08:02
Generate CLAHE-applied + resized Image for Sorghum -100 Cultivar Identification - FGVC 9
import os
import torch
from torchvision import transforms as T
import PIL
import numpy as np
import cv2
def tensor2np(tensor):
return tensor.permute(1, 2, 0).numpy().astype(np.uint8)
@joonas-yoon
joonas-yoon / value x to rgb
Last active May 9, 2023 08:31
f(x) = [r, g, b] ; from (1, 0, 0) to (0, 1, 0) to (0, 0, 1) for 0 <= x <= 1
def vec3(x):
return [
max(0.0, min(1.0 - 2.0*x, 1.0)),
abs(1.0 - abs(2.0*x - 1.0)),
max(0.0, min(2.0*x - 1.0, 1.0))
]
for i in range(100+1):
x = i/100
print(x, vec3(x))
@joonas-yoon
joonas-yoon / large_file_generator.py
Last active September 1, 2021 02:41
한글로만 이루어진 10GB짜리 파일 생성
import re
import random
import math
from datetime import datetime, timedelta
def print_progress_bar(time, percent, text, width):
length = int(width * percent / 100)
bar = '█' * length + '-' * (width - length)
prefix = time.strftime('[%H:%M:%S]')
percent_text = '{:.2f}'.format(percent)
@joonas-yoon
joonas-yoon / README.md
Last active April 28, 2021 14:18 — forked from michaelneu/README.md
A basic, but fast git prompt.

bash-basic-git-prompt

This is a considerably faster, but much more basic alternative to bash-git-prompt.

When adding this script to your .bash_profile or .bashrc, it'll display the selected branch of the current folder (if it's a git repo), and whether it's modified (yellow) or contains staged files (cyan).

example

The script makes the assumption, that a .git folder only exists when the directory is a git repo. Also, it checks for the english version of the git status command, so if you're using git in a different locale, make sure to adjust this.