본문 바로가기
반응형

전체 글33

[알고리즘] Javascript 로또의 최고 순위와 최저 순위 프로그래머스 로또의 최고 순위와 최저 순위 function solution(lottos, win_nums) { const answers = []; const lottoRank = { '6': 1, '5': 2, '4': 3, '3': 4, '2': 5, '1': 6, '0': 6, }; let mathLottoIndex = 0; let zeroLottoIndex = 0; for (const lottoNumber of lottos) { const matchStatus = win_nums.includes(lottoNumber); if (matchStatus) mathLottoIndex++; else if (lottoNumber === 0) zeroLottoIndex++; } const best = lotto.. 2021. 9. 17.
[Backend] Node.js 하위 폴더 읽기 및 파일 찾기 Node.js 하위 폴더 읽기 및 파일 찾기 const inspectionFindFile = (destPath) => { try { fs.readdirSync(destPath, { withFileTypes: true }) .forEach((file) => { const path = `${destPath}/${file.name}`; if (file.isDirectory()) { inspectionFindFile(path); } else { // 파일 처리 파일은 따로 배열에 담아 처리하시면됩니다. } }); } catch(err) { return console.error('Read Error', err); } } // 예시 경로입니다. inspectionFindFile(C:/Desktop/image); 검.. 2021. 9. 15.
[Shell Script] SSH / SCP 사용법 Shell Script SSH / SCP 사용법 SSH 사용법 ssh -l 사용자 ip주소 -p 서버포트 ssh -l ubuntu 0.0.0.0 8080 변수를 이용한 방식 user=ubuntu ip=0.0.0.0 port=8080 ssh -l $user $ip -p $port ssh 접속 후 shell 실행 ssh -l $user $ip -p $port "ls -la" ssh 접속 후 .sh 파일 실행 ssh -l $user $ip -p $port "bash < /data/bin/test.sh" SCP 사용법 scp -P 서버포트 전송할로컬파일경로 사용자@ip주소:옮겨지는서버폴더경로 scp -P 8080 C:/User/test/test.txt ubuntu@0.0.0.0:/data/bin 변수를 이용한 .. 2021. 9. 15.
반응형