Skip to content

Instantly share code, notes, and snippets.

View gunkim's full-sized avatar

Gun Kim gunkim

  • Gyeonggi, Republic of Korea
  • 13:19 (UTC +09:00)
View GitHub Profile
@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);
}
@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 / 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 / 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 / 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;
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
🌞 Morning 82 commits ██▋░░░░░░░░░░░░░░░░░░ 12.9%
🌆 Daytime 194 commits ██████▍░░░░░░░░░░░░░░ 30.5%
🌃 Evening 227 commits ███████▍░░░░░░░░░░░░░ 35.7%
🌙 Night 133 commits ████▍░░░░░░░░░░░░░░░░ 20.9%