Given a string, find the length of the longest substring without repeating characters. 주어진 문자열에서 반복되는 문자없이 가장 긴 부분 문자열의 길이를 찾습니다. /** * @param {string} s * @return {number} */ var lengthOfLongestSubstring = function(s) { var r = '', t = '', st = 0; for(let i = 0 ; i < s.length ; i++){ let index = t.indexOf(s[i]); if(index != -1){ st = st + index + 1; } t = s.substring(st, i+1); if(r.length < t.l..
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. 주어진 정수 배열을 이용하여 두 숫자의 인덱스를 반환하여 특정 대상에 합산합니다. 각 입력에는 정확히 하나의 솔루션이 있다고 가정 할 수 있으며 동일한 요소를 두 번 사용할 수 없습니다. /** * Definition for singly-linked list. * function ListNode(val) { * this.val ..
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. 주어진 정수 배열을 이용하여 두 숫자의 인덱스를 반환하여 특정 대상에 합산합니다. 각 입력에는 정확히 하나의 솔루션이 있다고 가정 할 수 있으며 동일한 요소를 두 번 사용할 수 없습니다. /** * @param {number[]} nums * @param {number} target * @return {number[]} */ v..
SSL 초간단 설정(Nginx, Apache) 1) Nginx (1) HTTP(80) -> HTTPS(443) 리다이렉트 Redirect server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri;} (2) HTTPS 443 SSL 설정 server { listen 443 ssl default_server; listen [::]:443 ssl default_server; server_name _; ssl on; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.p..
Nginx Conf 파일 설정 기본적으로는 nginx.conf 파일을 설정해야 하지만 해당 경로 안에 Include 경로가 있기 때문에 보통은 다른 파일을 설정 한다. server { listen 80; // 80 번 포트를 연다 location / { // 루트 경로로 들어왔을 때 이동을 함 proxy_pass http://127.0.0.1:8000; // 80번으로 들어오면 8000번 포트로 이동을 하겠다고 선언 proxy_http_version 1.1; proxy_set_header Connection ""; } location ~ ^/static/ { root /root/static; // /static 경로로 들어온 거는 해당 경로로 포워딩 }} 프록시 패스를 사용하지 않은 경우엔root 변수를..
레디스를 사용하다보면DENIED Redis is running in protected mode because protected 다음과 같은 에러를 볼 수 있는데 Redis 3.2 부터인가 보안 모드가 추가되어서 패치되었다고 한다. 주로 원격에서 레디스 서버로 접속할 때 에러가 뜬다. 2가지 방법이 있는데 레디스 서버에서 1) 직접 입력 127.0.0.1:6379> config set protected-mode no 2) config 파일 수정 보통 /etc/redis/redis.conf ( 파일 설정 하는 곳마다 위치가 다르다 ) protected-mode와 bind를 수정한다. #protected-mode yes protected-mode no #bind 그리고 레디스 서버 재시작 하면 접속이 잘 되는..