[프로그래머스] K번째수 - 정렬
·
BE/algorithm
문제링크 https://programmers.co.kr/learn/courses/30/lessons/42748 코딩테스트 연습 - K번째수 [1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3] programmers.co.kr 문제풀이 import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * K번째수 * https://programmers.co.kr/learn/courses/30/lessons/42748 */ public class Solution { public int[] solution(int[] array, int[][] commands) { Lis..
[프로그래머스] 완주하지 못한 선수 - 해시
·
BE/algorithm
문제 링크 https://programmers.co.kr/learn/courses/30/lessons/42576 문제 풀이 import java.util.HashMap; import java.util.Map; /** * 완주하지 못한 선수 * https://programmers.co.kr/learn/courses/30/lessons/42576 */ class Solution1 { public String solution(String[] participant, String[] completion) { Map map = new HashMap(); // convert array to hashmap for completion for (String person : participant) { if (map.cont..
[프로그래머스] 모의고사 - 완전탐색
·
BE/algorithm
문제 링크 https://programmers.co.kr/learn/courses/30/lessons/42840 코딩테스트 연습 - 모의고사 수포자는 수학을 포기한 사람의 준말입니다. 수포자 삼인방은 모의고사에 수학 문제를 전부 찍으려 합니다. 수포자는 1번 문제부터 마지막 문제까지 다음과 같이 찍습니다. 1번 수포자가 찍는 programmers.co.kr 문제 풀이 import java.util.ArrayList; import java.util.List; /** * 프로그래머스:완전탐색:모의고사 * https://programmers.co.kr/learn/courses/30/lessons/42840 */ class Solution { public int[] solution(int[] answers) {..
[대충로그] grafana-loki query
·
DevOps/monitoring
loki로 수집된 로그중에 json body (string)에서 값을 쿼리해야한다. loki로 수집된 로그중에 json body (string)에서 값을 쿼리해야한다. {container_name="도커컨테이너명"} |= " orderNo" |= "123123123" { } 안의 값은 label |= 는 로그 파이프라인, 필터처럼 사용
[ubuntu] python을 찾을 수 없다고 할때
·
DevOps/devops
Command 'python' not found, but can be installed with: 라고 뜨는 경우가 있다. 하지만 python은 설치 되어있는데? 🤔고민하지 말고 아래와 같이 입력해주자. # 터미널 (bashrc or bash_aliases) vim ~/.bashrc # bashrc (python3나 원하는 python 버전) alias python=python3 # 터미널 source ~/.bashrc 다시 python을 입력하면, 원하는 버전에 맞게 잘 실행되는것을 확인할 수 있다.
[TIL] pip install 시 "Consider using the `--user` option or check the permissions" 에러
·
DevOps/etc
Consider using the `--user` option or check the permissions. pip로 패키지 설치시 이런 에러가 발생함. 권한이 없는 디렉토리에서 설치하려고 하기 때문에 발생하는 에러. --user 옵션을 넣어서 설치하면 된다. 뭐든 모를땐 man page 나 -h를 사용해서 설명을 읽어본다. --user 옵션은 권한없는 디렉토리 (내경우의 C드라이브)가 아닌 사용자의 디렉토리 (home directory)에 설치해준다. --user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows. (See the Python do..
crontab 을 사용해보자
·
DevOps/etc
서버에서 주기적으로 작업을 해야하는 일을 생성할때는 종종 crontab을 사용한다. cron으로 등록된 job list 확인 crontab -l cron에 새로운 job을 등록 crontab -e cron 스케줄 expression 주기적으로 cron을 실행시키기 위해서는 다음의 expression과 함께 등록해야한다. [분] [시간] [날짜/월] [월] [날짜/주] wildcard sign = any 예시 아래와 같이 세팅하면 매주 0시 0분 (자정) 목요일에 해당 file path에 있는 스크립트를 실행 으로 해석하면 된다. 0 0 * * THU [file path] 참고 cron schedule 유용한 링크: https://crontab.guru/
[curl] (60) SSL certificate problem: certificate has expired
·
DevOps/etc
curl command 를 사용하다가 만난 이슈 해결방법 (임시방편) curl의 옵션인 -k (or --insecure)를 사용한다. certificate validation을 스킵해준다.