commit 89dd48a3641bf1d2c9d7474c64e26b8d3fb79ac3 Author: PinforYou Date: Wed May 28 14:26:49 2025 +0900 first commit diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..a279190 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/english_project.iml b/.idea/english_project.iml new file mode 100644 index 0000000..8437fe6 --- /dev/null +++ b/.idea/english_project.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..dc9ea49 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..97282b9 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DungGeunMo.ttf b/DungGeunMo.ttf new file mode 100644 index 0000000..95ba5bc Binary files /dev/null and b/DungGeunMo.ttf differ diff --git a/NeoDunggeunmoPro-Regular.ttf b/NeoDunggeunmoPro-Regular.ttf new file mode 100644 index 0000000..29bc1b1 Binary files /dev/null and b/NeoDunggeunmoPro-Regular.ttf differ diff --git a/PyAudio b/PyAudio new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/apa102.py b/apa102.py new file mode 100644 index 0000000..5f7ba59 --- /dev/null +++ b/apa102.py @@ -0,0 +1,100 @@ +import time +import random +from PIL import Image, ImageDraw +from luma.led_matrix.device import max7219 +from luma.core.interface.serial import spi, noop + +# SPI 인터페이스 설정 +serial = spi(port=0, device=0, gpio=noop()) +device = max7219(serial, width=32, height=16, block_orientation=-90, blocks_arranged_in_reverse_order=False) + +# 매트릭스 크기 +matrix_width = 32 +matrix_height = 16 + +# 눈동자 이미지 생성 +eye_width = 8 +eye_height = 8 +eye_color = 255 # 흰색 + +eye_image = Image.new("1", (matrix_width, matrix_height), color=0) # 도트 매트릭스 크기로 이미지 생성 +eye_draw = ImageDraw.Draw(eye_image) +eye_draw.rectangle([0, 0, eye_width, eye_height], fill=eye_color) + +# 시작 위치 +current_position = [matrix_width // 2 - eye_width // 2, matrix_height // 2 - eye_height // 2] + +# 눈동자 이동 속도 (초 단위) +movement_speed = 0.1 + +try: + while True: + # 눈동자 위치 랜덤으로 이동 + new_position = [random.randint(0, matrix_width - eye_width), random.randint(0, matrix_height - eye_height)] + print(type(new_position)) + + + # 이동 방향 계산 + dx = 1 if new_position[0] > current_position[0] else -1 + dy = 1 if new_position[1] > current_position[1] else -1 + + # 눈동자 부드럽게 이동 + while current_position != new_position: + # 이동 방향으로 한 픽셀씩 이동 + current_position[0] += dx + current_position[1] += dy + + print(current_position) + + # 매트릭스에 이미지 표시 + device.clear() + device.display(eye_image) + device.show() + time.sleep(movement_speed) + + # 잠시 멈춤 + time.sleep(1) + +except KeyboardInterrupt: + pass +finally: + device.clear() + +#타이머 +# import time +# from datetime import datetime, timedelta +# from PIL import Image, ImageDraw, ImageFont +# from luma.led_matrix.device import max7219 +# from luma.core.interface.serial import spi, noop +# +# # SPI 인터페이스 설정 +# serial = spi(port=0, device=0, gpio=noop()) +# device = max7219(serial,width=32, height=16,block_orientation=-90, blocks_arranged_in_reverse_order=False) +# +# # 타이머 설정 (초 단위) +# timer_duration = 300 # 5분 타이머 예시 +# end_time = datetime.now() + timedelta(seconds=timer_duration) +# +# try: +# while datetime.now() < end_time: +# remaining_time = end_time - datetime.now() +# seconds = int(remaining_time.total_seconds()) +# +# # 분과 초 분리 +# minutes, seconds = divmod(seconds, 60) +# +# # 이미지 생성 +# image = Image.new("1", (device.width, device.height), color=0) +# draw = ImageDraw.Draw(image) +# font = ImageFont.load_default() +# +# # 텍스트 그리기 +# text = f"{minutes:02d}:{seconds:02d}" +# draw.text((2, 2), text, font=font, fill=255) +# +# # 매트릭스에 이미지 표시 +# device.display(image) +# time.sleep(1) # 1초마다 갱신 +# +# finally: +# device.clear() \ No newline at end of file diff --git a/boot_start.py b/boot_start.py new file mode 100644 index 0000000..e1dc06f --- /dev/null +++ b/boot_start.py @@ -0,0 +1,22 @@ +import os +import json + +routes = json.loads(os.popen("ip -j -4 route").read()) +ip='' +for r in routes: + if r.get("dev") == "wlan0" and r.get("prefsrc"): + ip = r['prefsrc'] + continue + +if ip == "": + print('초기설정') +elif ip == "10.42.0.1": + print('초기설정') +else: + stream = os.popen('sudo nmcli connection up HOTSPOT') + output = stream.read() + print(output) + + + + diff --git a/daum_english.py b/daum_english.py new file mode 100644 index 0000000..8a8f805 --- /dev/null +++ b/daum_english.py @@ -0,0 +1,129 @@ +import pymysql +import requests +from bs4 import BeautifulSoup +import random +import time +import json + + +def fetch_random_words(connection, limit=1): + with connection.cursor() as cursor: + sql = "SELECT word FROM ew_word ORDER BY RAND() LIMIT %s" + cursor.execute(sql, (limit,)) + result = cursor.fetchall() + return [row['word'] for row in result] + + +def fetch_search_results(search_term, session): + # URL 설정 + base_url = 'https://dic.daum.net/search.do?q=' + url = f"{base_url}{search_term}" + + # HTTP GET 요청을 보내고 응답을 가져옴 + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36", + "Accept-Language": "en-US,en;q=0.9", + "Accept-Encoding": "gzip, deflate, br", + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", + "Connection": "keep-alive", + "Upgrade-Insecure-Requests": "1" + } + response = session.get(url, headers=headers) + response.raise_for_status() + + return response.text + + +def parse_results(html): + soup = BeautifulSoup(html, 'html.parser') + results = {} + + # 값 추출 + emph_span = soup.find('span', class_='txt_emph1') + results['txt_emph1'] = emph_span.get_text(strip=True) if emph_span else 'N/A' + + #