surfharu

[docker] no space left on device 해결 방법 (feat.Mac)

Problem docker 이미지 신규 설치 시 no space left on device 오류가 발생함. 하드 용량은 충분하였지만 docker에 할당된 디스크 용량이 부족해서 나타난 현상이다. docker: failed to register layer: Error processing tar file(exit status 1): write /usr/...

ChatGPT 자주 쓰는 프롬프트 모음

ChatGPT 활용 시 자주 쓰는 프롬프트를 정리해 둔다. 자주 쓰는 프롬프트 문장 문법에 맞게 수정 correct? I played soccer tommorow. 이메일 작성 write an email to cancel my reservation. (정중하게) write an email politely to cancel my r...

javascript 성능 테스트

javascript는 기본적으로 성능 테스트를 위한 performance.now() 메서드를 지원한다. 간단한 메서드 성능 테스트는 아래와 같이 쉽게 사용 가능하다. Usage const array = new Array(1000000).fill().map((_, i) => i) let value = 0; const t0 = performanc...

How to install ClamAV on docker and use it in nodejs

Let’s use ClamAV, an open-source anti-virus software, in nodejs. ClamAV ? ClamAV is a free antivirus software that detects viruses, Trojans, worms, and spam on Linux, macOS, and Windows operati...

How to return a value from an asynchronous callback function?

The example below is a function that returns a value using a callback function at stream completion. After reading the file, the end callback function returns a value. However, totalBytes is undefi...

EC2 터미널 접속 불가 시 해결 방법 (feat. CPU 100%)

Problem ec2 서버에 clamav를 설치하던 중 ssh 터미널이 먹통이 되버림 … clamav 이란? 리눅스에서 무료로 사용가능한 Anti-virus 오픈소스 솔루션 모니터링 페이지를 조회하니 cpu가 100% 였다. 최소 티어(t2)를 사용 중인데 오버스펙의 솔루션을 설치해서 먹통이 된 듯 보인다. Solution ...

[vscode] massCode 활용하여 코드 생산성 높이기

Code Snippets 도구 중에 하나인 massCode를 활용하여 코드 생산성을 높여 본다. Code Snippets 이란? 자주 사용하는 코드나 템플릿을 모아두는 것을 말함 먼저 massCode 사이트에 접속하여 os 버전에 맞는 클라이언트 툴을 다운 받아 설치한다. massCode massCode 를 실행하면 원하는 코드를 ...

[nodejs] JWT(Json Web Token)

JWT 란? Json Web Token의 약자로 json 형태로 사용자의 속성 정보를 암호화하여 저장해 주는 대표 모듈이다. JWT - Wiki Prerequisites nodejs JWT 설치 npm install jsonwebtoken JWT 암호화 // jsonwebtoken 사용하기 위해 불러오기 import jwt fro...

[javascript] 2차원 배열 만들기

javascript 에서는 2차원 배열을 기본적으로 지원하지 않는다. let array = [][] // 지원 안함 2차원 배열 생성 방법 2차원 배열 (19 * 19)을 생성해 보자. 1. 배열안에 배열을 생성하여 사용 let row = 19; let board = new Array(row); for(let i = 0; i < row; ...

CORS(Cross-Origin Resource Sharing)

CORS(Cross-Origin Resource Sharing)란 ? 웹 브라우저에서 제공하는 기능으로, 서로 다른 출처(origin)간에 자원을 공유할 수 있도록 하는 것을 의미한다. 웹 서버가 CORS 허용을 하게 되면, 서버에 접근하고자 하는 클라이언트 측 요청을 허용하게 된다. CORS 허용 방법 클라이언트(브라우저) 설정 변경 서버...