분류 전체보기
-
inferComputer Science/TypeScript 2023. 9. 30. 22:40
infer는 조건부 타입에서만 사용이 가능하다. Conditional types ( 조건부 타입 ) 조건부타입은 TypeScript에서 특정 조건에 따라 타입을 결정하는 기능이다. T extends U ? X : Y 형태를 가지며 이는 타입 T가 타입 U에 할당 가능하면 X 타입을 반환하고, 그렇지 않으면 Y 타입을 반환한다는 뜻이다. type IsString = T extends string ? "yes" : "no"; type Test1 = IsString; // "yes" type Test2 = IsString; // "no" infer 조건부 타입 내에서 동적으로 타입을 추론할 때 사용한다 type ReturnTypeOf = T extends (...args: any[]) => infer R ? ..
-
type vs interfaceComputer Science/TypeScript 2023. 9. 22. 22:57
https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces Documentation - Everyday Types The language primitives. www.typescriptlang.org TypeScript 공식 사이트에서 간략하게 차이를 설명하고 있다. 1. 선언 Interface 와 type 모두 타입을 정의하는 주요 방법이지만, 선언 방식과 정의 할 수 있는 경우의 차이가 존재한다. 둘다 객체와 함수를 정의할 수 있지만 string, number, union, tuple 등 기본 타입은 type 에서만 선언 할 수 있으며 interface에서..
-
Spin Lock vs Mutex vs SemaphoreComputer Science 2023. 9. 18. 16:11
1. 스핀락 2. 뮤텍스 3. 세마포어 4. 스핀락 vs 뮤텍스 5. 이진 세마포어 vs 뮤텍스 스핀락 ( Spin Lock ), 뮤텍스 ( Mutex ), 세마포어 ( Semaphor ) 이 셋의 공통점은 동시성 프로그래밍에서 사용되는 동기화 기술이라는 것이다. 동시성 프로그래밍 ( Concurrency Programming ) 여러 스레드 혹은 프로세스로 작업을 처리하는 것으로 쉽게 말해 동시에 여러 작업을 처리하는 것이다. 동기화 ( Synchronization ) 여러 스레드 또는 프로세스 간의 작업 순서를 조절하고, 공유 자원에 대한 안전한 접근을 보장한다. 임계 영역 ( Critical Section ) 동시성 프로그래밍에서 상호 배제를 적용하는 영역이다. 이 영역은 한 번에 하나의 스레드 또..
-
TSC vs BabelComputer Science/TypeScript 2023. 9. 15. 16:18
1. TypeScript 란 2. tsc 란 3. Babel 이란 4. tsc vs babel 5. tsc 사용법 6. babel 사용법 TypeScript란 TypeScript는 JavaScript의 Superset으로 기존 JavaScript문법에서 정적 타입 시스템을 추가한 것으로 코드의 안정성과 가독성을 향상시킨다. 다면 결과적으로 실행되는 코드는 JavaScript이기에 TypeScript 문법에서 JavaScript문법으로 변환되는 과정이 필요하다. 이 과정에서 크게 2가지가 사용 되는데 tsc와 @babel/preset-typescript 이다. TSC 란 tsc는 TypeScript를 JavaScript로 변환시키는 명령어로 TypeScript Compiler 라고 할 수 있다. 현재 ts..
-
[k8s] TailScale subnet router 적용하기Computer Science/k8s 2023. 8. 24. 21:25
1. TailScale Auth key 생성 2. k8s Secret 생성 3. k8s Role 생성 4. k8s Deployment ( subnet router ) 생성 5. TailScale 연동 및 설정 1. TailScale Auth key 생성 Auth key를 생성해준다. 2. k8s Secret 생성 #tailscale-secret.yaml apiVersion: v1 kind: Secret metadata: name: tailscale-secret stringData: TS_AUTH_KEY: tskey-auth-###### 3. k8s Role 생성 # Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved. # Use of this ..
-
Iptables을 이용한 다른 IP로 포트포워딩Computer Science 2023. 8. 24. 20:26
해당 인스턴스에서 a port로 들어오는 트래픽을 b ip 의 c port로 포트포워딩하려고 합니다. 1. 인스턴스에서 네트워크 포트포워딩을 활성화 합니다. sudo sysctl -w net.ipv4.ip_forward=1 2. iptables 규칙 설정 sudo iptables -t nat -A PREROUTING -p tcp --dport [a port] -j DNAT --to-destination [b IP]:[c port] sudo iptables -t nat -A POSTROUTING -j MASQUERADE 아래의 명령어로 잘 적용되었나 확인할 수 있습니다. sudo iptables -t nat -L --line-numbers
-
Prometheus + Grafana 로 k8s 모니터링 하기Computer Science/Monitoring 2023. 8. 15. 05:02
1. Prometheus 설치 2. Grafana 설치 3. Grafana와 Prometheus 연동하기 1. Prometheus 설치 https://github.com/prometheus-community/helm-charts GitHub - prometheus-community/helm-charts: Prometheus community Helm charts Prometheus community Helm charts. Contribute to prometheus-community/helm-charts development by creating an account on GitHub. github.com 우선 monitoring namespace에서 진행하려고 하기에 namespace를 생성해준다. ku..
-
EFS를 pv, pvc로 k8s 환경에서 사용하기 ( NFS )Computer Science/k8s 2023. 8. 15. 02:12
1. EFS 생성 및 구성 1.1 DNS 호스트 이름 활성화 1.2 NFS 사용가능 여부 확인 1.3 EFS 생성 2. k8s 환경에 pv, pvc 구성 1. EFS 생성 및 구성 1.1 DNS 호스트 이름 활성화 우선 EFS 를 생성하기 전에 내가 사용할 vpc에서 DNS 호스트 이름이 활성화 되었는지 확인한다. 만약 활성화되어 있지 않다면 해당 "VPC 설정 편집" 을 통해서 활성화 해준다. 1.2 NFS 사용가능 여부 확인 https://docs.aws.amazon.com/ko_kr/efs/latest/ug/mounting-fs-old.html EFS 마운트 도우미 없이 파일 시스템 마운트하기 - Amazon Elastic File System Amazon EC2 인스턴스를 시작할 때 Amazon ..