Skip to content

Instantly share code, notes, and snippets.

View gunkim's full-sized avatar

Gun Kim gunkim

  • Gyeonggi, Republic of Korea
  • 00:34 (UTC +09:00)
View GitHub Profile
🌞 Morning 82 commits β–ˆβ–ˆβ–‹β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 12.9%
πŸŒ† Daytime 194 commits β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 30.5%
πŸŒƒ Evening 227 commits β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 35.7%
πŸŒ™ Night 133 commits β–ˆβ–ˆβ–ˆβ–ˆβ–β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 20.9%
fun hashCodeOf(vararg values: Any?): Int =
values.fold(0) { acc, value ->
(acc * 31) + value.hashCode()
}
class Category(
val id: Long? = null,
val name: String,
val createdAt: LocalDateTime? = null,
val updatedAt: LocalDateTime? = null
@gunkim
gunkim / DatabaseClean.java
Last active November 13, 2022 16:31
λ°μ΄ν„°λ² μ΄μŠ€λ₯Ό ν¬ν•¨ν•œ ν…ŒμŠ€νŠΈ μ‹œ ν…ŒμŠ€νŠΈ 격리λ₯Ό μœ„ν•œ λ°μ΄ν„°λ² μ΄μŠ€ μ΄ˆκΈ°ν™” μ½”λ“œ
import com.google.common.base.CaseFormat;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import java.util.List;
@gunkim
gunkim / ThreadMain.kt
Created April 18, 2023 16:41
μŠ€λ ˆλ“œ 타이핑 μ—°μŠ΅
package io.github.gunkim
fun main() {
val thread = Thread {
System.out.printf("ν˜„μž¬ μŠ€λ ˆλ“œ : %s%n", Thread.currentThread().name)
System.out.printf("ν˜„μž¬ μŠ€λ ˆλ“œμ—λŠ” μš°μ„ μˆœμœ„κ°€ μ„€μ •λ˜μ—ˆμŒ. %s", Thread.currentThread().priority)
}.apply {
name = "μƒˆ μž‘μ—… μŠ€λ ˆλ“œ"
priority = Thread.MAX_PRIORITY
uncaughtExceptionHandler = Thread.UncaughtExceptionHandler { t: Thread, e: Throwable ->
@gunkim
gunkim / docker-compose.yml
Last active June 3, 2023 18:36
둜컬 λ””λΉ„ μƒμ„±μš©
version: '3'
services:
gift-db:
image: amd64/mysql
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: 1234
@gunkim
gunkim / Main.kt
Created August 5, 2023 10:36
트리 순회 μ—°μŠ΅
data class Node(
val data: Int,
var left: Node? = null,
var right: Node? = null
)
/**
* 1
* /\
* 2 3
@gunkim
gunkim / main.c
Last active November 2, 2023 01:59
pthread μ‹€μ‹œκ°„ CPU μŠ€μΌ€μ€„λ§ 예제 μ½”λ“œ
#include <pthread.h> // POSIX μŠ€λ ˆλ“œ μ‚¬μš©μ„ μœ„ν•œ 헀더 파일
#include <stdio.h> // μž…μΆœλ ₯ κ΄€λ ¨ 헀더 파일
#define NUM_THREADS 5 // 생성할 μŠ€λ ˆλ“œμ˜ 개수λ₯Ό μ •μ˜
// μŠ€λ ˆλ“œκ°€ μ‹€ν–‰ν•  ν•¨μˆ˜
void *runner(void *param) {
// μŠ€λ ˆλ“œ μ’…λ£Œ
pthread_exit(0);
}