분류
-
NanoID: 범영 고유 식별자 UUID 대체?컴퓨터 2021. 7. 2. 21:28
NanoID ai/nanoid A tiny (108 bytes), secure, URL-friendly, unique string ID generator for JavaScript - ai/nanoid github.com UUID란? UUID ( = GUID) 는 범용 고유 식별자로 소프트웨어 개발에 쓰이는 표준 식별자이다. 08f5fc3f-6de2-4822-9b05-817a201c7435 (v4) 위와 같이 랜덤으로 생성된 UUID는 그 어떠한 것과도 같은 uuid를 가질 수 없다. (0.00000006 % 확률로 같음) (UUID는 버전 5까지 나온 상태) 어디에 쓰이냐면 예를 들어, 테이블의 key 값이나 파일 업로드 시 임시 파일명으로 쓰일 수 있다. NanoID UUID 보다 7살 정도 어리지만..
-
Python Selenium: 여러가지 팁컴퓨터/파이썬 2021. 6. 7. 16:25
1. 크롬 드라이버를 알아서 다운로드해서 설정 이유: 셀레니움을 이용한 콘솔 앱을 만들었는데 chrome이 업데이트된 후에 정상적으로 작동하지 않음 webdriver-manager를 이용해서 알아서 다운로드 시킨다. (크롬, firefox, IE, edge를 지원함) pip install webdriver-manager 예제 import os import sys from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager def resource_path(another_way): try: usual_way = ( s..
-
Pyston: Python 3.8.8 최적화 버전컴퓨터/파이썬 2021. 5. 9. 21:17
pyston pyston/pyston A faster and highly-compatible implementation of the Python programming language. - pyston/pyston github.com 소개 아직은 linux 계열밖에 사용 못한다. 특징은 다음과 같다. (+ pip-pyston으로 python의 모든 모듈과 호환됨) (리얼 프로덕션에서 30% 성능 향상을 볼 수 있다고 소개되어있다.) - A very-low-overhead JIT using DynASM - Quickening (인터프리터 효율적으로 하는 방법) - Aggressive attribute caching - General CPython optimizations - Build process impr..
-
Rust 문법: dyn, trait, polymorphism컴퓨터/Rust 2021. 5. 2. 20:50
Rust Using Trait Objects That Allow for Values of Different Types - The Rust Programming Language Chapter 8 doc.rust-lang.org 1. dyn, trait trait: unknown 타입 (Self)을 위해 정의된 메서드 collection doc.rust-lang.org/book/ch10-02-traits.html?highlight=trait#traits-defining-shared-behavior dyn: dynamic 하게 dispatch 되는 부분을 highlight (dynamic dispatch to a trait object) 2. 예제 코드 자바/파이썬 개념으로 설명하면 Car, Motocycle..
-
Rust 문법: Ownership (소유권)컴퓨터/Rust 2021. 4. 24. 20:33
Rust Rust Programming Language A language empowering everyone to build reliable and efficient software. www.rust-lang.org 1. 소개 수많은 언어에 존재하지 않는 Rust만의 특징인, ownership, borrowing이란 개념이 있다. (포인터처럼 접근해서 생각하면 편할 것이다.) 코어 콘셉트는 다음과 같다. 데이터는 오직 하나의 소유자를 가질 수 있다. 빌려간 데이터는 exclusive mutable이거나 shared immutable이다. ex) 변수 a를 지정 후 b가 a를 지정하면 a를 사용불가 상태가 된다. 위와 같은 코드를 실행하면 x는 1을 가리키고, y도 1을 가리키는 stack에서 새로 생성..
-
Rust: PyO3 파이썬 모듈 Rust 언어로 만들기컴퓨터/Rust 2021. 4. 24. 19:52
Rust PyO3 Rust Programming Language A language empowering everyone to build reliable and efficient software. www.rust-lang.org 1. 소개 CPython API를 통해 Python 모듈을 빠르게 만드는 방법과 같이 Rust로 만들 수 있다. Python 모듈 C언어로 만들기 Python 모듈 1. 소개 전 ctype으로 C언어 코딩 실행하기와 비슷한데 실제로 pip으로 설치할 수 있는 파이썬 패키지를 C언어로 만들어 볼 것이다. Python Github의 C 파일들은 보면 문법이 어느 정도 감이 www.seokdev.site Rust로 만들 경우 몇 % 의 성능 향상이 있을진 모른다. gil 사용 안 한 p..
-
Python: Generic 함수 만들기 (functools.singledispatch)컴퓨터/파이썬 2021. 4. 7. 21:34
functools 1. 소개 fastcore를 소개했을 때 Julia 언어의 멀티 디스패치 기능을 소개했었는데 Python fastcore: 파이썬 업그레이드 모듈 fastcore fast.ai fastcore Github 링크 github.com fast.ai에서 제작한 파이썬 언어 확장 모듈 1. 소개 fastcore은 Julia 언어의 multiple dispatch, Ruby 언어의 mixins, Haskell 언어의 currying, binding 등.. www.seokdev.site 기본 모듈에서 싱글 디스패치 제너릭 함수를 지원하는지 몰랐다. (3.4+ 이상부터 지원) 파이썬에서는 타입을 신경 쓰진 않지만 3.7+이상부턴 타입 힌트를 써주는 게 convention이 된 것 같다. 코드를 깔끔..