- SOLID 원칙을 지키면서 구현합니다.
- 메서드는 짧게, 한가지 기능만 수행하도록 합니다.
- 빠른 구현보다는 항상 깨끗하고 잘 테스트된 코드를 우선시합니다.
- 단순성: 복잡한 것 보다, 단순한 해법을 선택합니다.
- DRY (Don't Repeat Yourself): 코드 중복을 철저히 피합니다.
- 최소 상태: 가능한한 적은 상태만으로 동작하도록 합니다.
- 상수 정의: 매직 넘버나 문자열은 명확한 이름의 상수로 정의합니다.
당신은 최신 기술 스택에 정통한 시니어 백엔드 개발자입니다. 생산성과 개발자 경험(DevEx)을 극대화하는 모범 사례를 따르며, 확장 가능하고 유지보수가 용이한 프로젝트 구조를 설계하는 데 능숙합니다.
실무에 바로 투입할 수 있는 현대적인 Django 프로젝트의 기반(Boilerplate)을 구축합니다. 이 프로젝트는 초기 설정의 번거로움을 최소화하고, 팀원이 즉시 개발에 집중할 수 있도록 견고한 구조와 자동화된 개발 환경을 갖춰야 합니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def arrowed_spines(fig, ax, remove_ticks=False): | |
""" | |
좌표축 화살표를 그리기 위한 함수 | |
https://stackoverflow.com/questions/33737736/matplotlib-axis-arrow-tip | |
""" | |
xmin, xmax = ax.get_xlim() | |
ymin, ymax = ax.get_ylim() | |
# removing the default axis on all sides: | |
for side in ['bottom','right','top','left']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# 활성화 함수와 그 도함수 | |
def sigmoid(x): | |
return 1 / (1 + np.exp(-x)) | |
def sigmoid_derivative(x): | |
return x * (1 - x) | |
# 학습 데이터 (하나의 샘플) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import pipeline | |
generator = pipeline('text-generation', model = 'beomi/llama-2-ko-7b') | |
print("===========") | |
a = generator( | |
"""### System: | |
You are Free Willy, an AI that follows instructions extremely well. | |
Help as much as you can. | |
Remember, be safe, and don't do anything illegal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Working config for auth_request with proxy_cache. (nginx 1.18.0) | |
# https://gist.github.com/jinto/f120e497db8d39d866db49ff2454b7b3 | |
# ... | |
proxy_cache_path /tmp/cache_xx levels=1:2 keys_zone=auth_cache:10m max_size=128m inactive=10m use_temp_path=off; | |
server { | |
location / { | |
auth_request /_ml_proxy/auth; | |
# ... | |
proxy_pass http://backend_ip:7860/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* With java8 lambda you can use JDBC like | |
* | |
* return select("SELECT fields from table_name where id=?", (params)-> { | |
* params.add("user_id"); | |
* }); | |
* | |
*/ | |
import java.util.List; | |
import java.util.ArrayList; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# problem is code duplication. | |
from django.db import connections | |
class Dao: | |
@classmethod | |
def get_list(cls): | |
try: | |
conn = connections["db_name"] | |
cursor = conn.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/sites-enabled/site-domain | |
upstream backend { | |
server 127.0.0.1:7777 weight=100 max_fails=5 fail_timeout=5; | |
server 127.0.0.1:7778 weight=100 max_fails=5 fail_timeout=5; | |
} | |
server { | |
listen 80; | |
server_name www.xxx.com; | |
return 301 http://xxx.com$request_uri; |
NewerOlder