Skip to content

Instantly share code, notes, and snippets.

View dongju93's full-sized avatar
๐ŸŽฏ
Focusing

Lee Dongju dongju93

๐ŸŽฏ
Focusing
View GitHub Profile
@dongju93
dongju93 / net_scanner.go
Last active August 27, 2025 23:55
Network Scanner
package main
import (
"bytes"
"context"
"encoding/json/jsontext"
v2 "encoding/json/v2"
"fmt"
"log"
"net"
@dongju93
dongju93 / file_cache_to_memory.py
Created August 24, 2025 09:42
Memory Efficiency File Cache
import asyncio
import json
import os
import time
from collections import OrderedDict
from dataclasses import dataclass
from typing import Any
import aiofiles
@dongju93
dongju93 / consumer.py
Created August 15, 2025 13:09
RabbitMQ Async Pub-Con
import asyncio
import json
from datetime import datetime
from typing import Any
import aio_pika
from aio_pika.abc import AbstractChannel, AbstractQueue, AbstractRobustConnection
RABBITMQ_URL = "amqp://<USER>:<PASSWORD>@localhost:5672/<VHOST>"
QUEUE_NAME = "demo.queue"
@dongju93
dongju93 / App.tsx
Created August 13, 2025 07:23
Tailwind CSS v4 Light/Dark mode
import { useTheme } from "./theme";
function App() {
const { isDark, toggleTheme } = useTheme();
return (
<div
id="top"
className="min-h-screen bg-white text-gray-900 dark:bg-gray-950 dark:text-gray-100"
>
@dongju93
dongju93 / calculator.py
Created July 27, 2025 16:46
Calculator TUI (WIP)
from decimal import Decimal
from textual.app import App, ComposeResult
from textual.containers import Container
from textual.reactive import var
from textual.widgets import Button, Digits
"""
* Import Description
- App: ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ธฐ๋ณธ ํด๋ž˜์Šค
@dongju93
dongju93 / tower_of_hanoi.py
Last active July 20, 2025 11:51
The Tower of Hanoi
def recursive_tower_of_hanoi(n, source="A", auxiliary="B", destination="C"):
"""
์žฌ๊ท€ ํ˜ธ์ถœ์„ ์ด์šฉํ•ด ํ•˜๋…ธ์ด์˜ ํƒ‘ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค.
๋งค๊ฐœ๋ณ€์ˆ˜:
n (int): ๋””์Šคํฌ ๊ฐœ์ˆ˜ (0 ์ด์ƒ์˜ ์ •์ˆ˜์—ฌ์•ผ ํ•จ)
source (str): ์‹œ์ž‘ ๊ธฐ๋‘ฅ ์ด๋ฆ„
auxiliary (str): ๋ณด์กฐ ๊ธฐ๋‘ฅ ์ด๋ฆ„
destination (str): ๋ชฉ์ ์ง€ ๊ธฐ๋‘ฅ ์ด๋ฆ„
@dongju93
dongju93 / maze.py
Created July 20, 2025 11:31
Find 2D Maze Path Recursively
def recursive_solve(maze, x, y, end_x, end_y):
# ๋ฏธ๋กœ ํฌ๊ธฐ
rows = len(maze)
cols = len(maze[0])
# ๊ธฐ์ € ์กฐ๊ฑด: ๋ชฉํ‘œ ์ง€์ ์— ๋„๋‹ฌ
if x == end_x and y == end_y:
maze[x][y] = 2 # ๊ฒฝ๋กœ ํ‘œ์‹œ
return True
@dongju93
dongju93 / counting.py
Last active July 20, 2025 10:17
Sort Algorithm
"""
Counting Sort Algorithm Implementation
๊ณ„์ˆ˜ ์ •๋ ฌ: ๊ฐ ์›์†Œ์˜ ๊ฐœ์ˆ˜๋ฅผ ์„ธ์–ด ์ •๋ ฌํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜
์‹œ๊ฐ„ ๋ณต์žก๋„: O(n + k) where k is the range of input
๊ณต๊ฐ„ ๋ณต์žก๋„: O(k)
"""
import random
import time
@dongju93
dongju93 / http_server.py
Last active July 19, 2025 16:14
HTTP/1.1 Server
#!/usr/bin/env python3
"""
Self-contained HTTP/1.1 server using only Python standard library.
Listens on port 8080, parses requests manually, routes GET/POST requests,
and logs raw TCP stream to stdout.
"""
import datetime
import socket
import sys
@dongju93
dongju93 / send_mail.py
Created July 13, 2025 19:25
Send 2FA Code Email
# requirements:
# pip install Jinja2 secure-smtplib
import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from pathlib import Path
from jinja2 import Environment, FileSystemLoader