Skip to content

Instantly share code, notes, and snippets.

View xoxwgys56's full-sized avatar
🚶
As it was

Yoooda xoxwgys56

🚶
As it was
View GitHub Profile
@xoxwgys56
xoxwgys56 / README.md
Last active December 12, 2023 04:43
Python MRO
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats '%b '
setopt PROMPT_SUBST
PROMPT='%F{#f8f8f2}%*%f %F{#bd93f9}%2~%f% %F{#ff5555}${vcs_info_msg_0_}%f$ '
@xoxwgys56
xoxwgys56 / django_queryset_simple.py
Created December 20, 2022 00:43 — forked from KimSoungRyoul/django_queryset_simple.py
Django QuerySet 구성요소 간단하게
from django.db.model.sql import Query # Query()는 개발자가 정의한 QuerySet을 읽어서 실제 SQL을 생성해주는 구현체다
class QuerySet:
query: Query = Query() # 이것을 나는 메인쿼리 라고 명명한다.
_result_cache: List[Dict[Any,Any]] = dict() # SQL의 수행결과를 여기 저장해놓고 재사용한다 (QuerySet Cache)
# QuerySet 재호출시 이 프로퍼티에 저장된 데이터가 없으면 SQL을 호출해서 데이터를 가져온다.
_prefetch_related_lookups: Tuple[str] = () # prefetch_related(여기선언된 값들) 을 이 프로퍼티에 저장함
# 이것을 나는 추가쿼리(셋)이라고 명명한다.
@xoxwgys56
xoxwgys56 / README.md
Created December 9, 2022 05:25
zsh prompt

zsh prompt

show near by 2 directory only

# prompt
autoload -Uz vcs_info
precmd() { vcs_info }

zstyle ':vcs_info:git:*' formats '%b '
@xoxwgys56
xoxwgys56 / Dockerfile
Created October 19, 2022 02:39
no-gil test
FROM nogil/python
WORKDIR /
# If enable gil uncomment below:
# ENV PYTHONGIL=1
COPY ./main.py /main.py
CMD ["python", "/main.py"]
@xoxwgys56
xoxwgys56 / populate.sh
Created June 22, 2022 03:09
django populate data for testing
#!/bin/sh
# use this line. if you want interact with terminal
#
# docker-compose exec web python3 manage.py createsuperuser --username "admin" --email "admin@example.com"
# populate data for testing
#
# NOTE below code affect indent
docker-compose exec web sh -c "
@xoxwgys56
xoxwgys56 / install-docker.md
Created April 27, 2022 03:42 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@xoxwgys56
xoxwgys56 / index.html
Created January 17, 2022 04:36
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
@xoxwgys56
xoxwgys56 / index.html
Created January 17, 2022 04:36
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>
@xoxwgys56
xoxwgys56 / redirects-in-react-router-v6.md
Created December 15, 2021 15:52 — forked from mjackson/redirects-in-react-router-v6.md
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this: