core show version
Wooguy's Study
2025년 9월 11일 목요일
[ASTERISK] 02 실행확인
2023년 4월 5일 수요일
[NodeJS] 프로젝트에 힙 크기 할당 (PM2 이용)
pm2 설치
# npm을 사용하여 pm2-logrotate를 전역으로 설치
$sudo npm i pm2-logrotate -g
# 활성화
$sudo pm2 set pm2-logrotate:active true
# 설정변경 (선택사항)
$pm2 set pm2-logrotate:max_size 10M
$pm2 set pm2-logrotate:retain 7
$pm2 set pm2-logrotate:compress true
pm2 실행 시 메모리 할당
$pm2 start ./src/index.js --name 15_SCHE --node-args="--max-old-space-size=10240"
pm2를 이용하여 start 할 때 --node-args를 이용하여 nodejs에 인자를 전달한다.
--max-old-space-size 인자는 nodejs에서 Mbyte 단위의 메모리를 할당한다.
System의 램 용량을 확인하여 할당하도록 한다.
2023년 3월 27일 월요일
[AWS] Front에서 S3에 파일 직접 업로드
1. S3에 버킷 생성
2. 버킷 [권한] 설정
A. 퍼블릭 액세스 차단(버킷 설정)
B. 객체 소유권 편집
C. CORS 편집{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"HEAD"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [
"x-amz-server-side-encryption",
"x-amz-request-id",
"x-amz-id-2"
],
"MaxAgeSeconds": 3000
}
]
버킷명이 afterdata인 경우
2022년 12월 5일 월요일
[Javascript] call, apply, bind
JS에서는 함수 호출 방식과 관계없이 this를 지정할 수 있음
const mike = {
name: 'Mike',
};
const tom = {
name: 'Tom',
}
function showThisName() {
console.log(this.name);
}
showThisName(); // 아무것도 나오지 않음
showThisName.call(mike); // Mike
showThisName.call(tom); // Tom
// 함수.call()의 인자로 객체를 넘기면 this에 할당됨
function update(birthYear, occupation) {
this.birthYear = birthYear;
this.occupation = occupation;
}
update.call(mike, 1999, 'singer');
update.call(tom, 2002, 'teacher');
update.apply(mike, [1999, 'singer']);
update.apply(tom, [2002, 'teacher']);
const updateMike = update.bind(mike);
// mike 객체가 할당되어 update기능을 수행하는 updateMike라는 함수를 만듦
[Javascript] Number, Math
Number
toString()
: 10진수 -> 2진수/16진수
let num = 10;
num.toString(); // '10'
num.toString(2); // '1010'
let num2 = 255;
num2.toString(16); // 'ff'
toFixed()
: 소수점 자릿수
let userRate = 30.1234;
userRate.toFixed(2); // '30.12'
userRate.toFixed(0); // '30'
userRate.toFixed(6); // '30.123400'
Number(userRate.toFixed(2); // 30.12
Math
Math.PI; // 3.141592653589793
Math.ceil(); // 올림
Math.floor(); // 내림
Math.round(); // 반올림
Math.random(); // 0 ~ 1 사이 무작위 숫자 생성
Math.abs(n); // n의 절대값
Math.pow(n, m); // n의 m 거듭 제곱 값
Math.sqrt(n); // n의 제곱근
기능함수들
isNaN()
: NaN인지 아닌지 구분
parseInt()
parseFloat()
2022년 1월 2일 일요일
VSCODE 사용자코드
{