일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- hackerrank
- SW Expert Academy
- 캐치카페
- programmers
- 금융문자분석경진대회
- 우분투
- ubuntu
- 편스토랑
- dacon
- github
- gs25
- PYTHON
- 파이썬
- 코로나19
- Real or Not? NLP with Disaster Tweets
- 프로그래머스 파이썬
- 프로그래머스
- Baekjoon
- Docker
- 맥북
- 자연어처리
- leetcode
- 데이콘
- Git
- AI 경진대회
- Kaggle
- 편스토랑 우승상품
- 더현대서울 맛집
- ChatGPT
- 백준
- Today
- Total
목록
반응형
분류 전체보기 (1651)
솜씨좋은장씨
서버에서 5000포트를 열어두고 Flask로 API 개발을 하면서 로그를 확인하던 중 193.169.252.54 - - [19/Jan/2021 06:53:15] code 400, message Bad HTTP/0.9 request type ('\x03\x00\x00/*à\x00\x00\x00\x00\x00Cookie:') 193.169.252.54 - - [19/Jan/2021 06:53:15] "/*àCookie: mstshash=Administr" HTTPStatus.BAD_REQUEST - 193.169.252.54 - - [19/Jan/2021 06:53:16] code 400, message Bad HTTP/0.9 request type ('\x03\x00\x00/*à\x00\x00\x00\x0..
You are given a string text of words that are placed among some number of spaces. Each word consists of one or more lowercase English letters and are separated by at least one space. It's guaranteed that text contains at least one word. Rearrange the spaces so that there is an equal number of spaces between every pair of adjacent words and that number is maximized. If you cannot redistribute all..
서버에 접속하기 위해서 $ ssh -i ~/somjang/server_keys/server_key.pem ubuntu@0.0.0.0 위와 같이 접속을 시도하였으나 아래와 같은 오류가 발생하게 되었습니다. The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established. ECDSA key fingerprint is SHA256:sdfkjdlskdjflskdjflksjdflskdjlskfjsdlkf. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts..
Given a non-empty, singly linked list with head node head, return a middle node of linked list. If there are two middle nodes, return the second middle node. Example 1: Input: [1,2,3,4,5] Output: Node 3 from this list (Serialization: [3,4,5]) The returned node has value 3. (The judge's serialization of this node is [3,4,5]). Note that we returned a ListNode object ans, such that: ans.val = 3, an..
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero. Example 1: Input: bits = [1, 0, 0] Output: True Explanation: The only way to decode i..
Given an array A of integers, for each integer A[i] we may choose any x with -K
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in this word are not capitals, like "leetcode". Only the first letter in this word is capital, like "Google". Otherwise, we define that this word doesn't use..
최근 프로젝트를 진행하면서 개발하는 서버에 Elasticsearch를 설치해두고 편하게 사용하기 위하여 Elasticsearch의 9200 포트, Kibana의 5601 포트에 대해서 외부의 모든 접근을 허용하도록 인바운드 규칙을 설정해 두었었습니다. 설치를 하고 테스트로 제대로 동작하는지 인덱스를 생성해보고 더미 데이터를 인덱싱 해두었다가 이제 실제로 사용하려고 다시 Kibana를 켜서 인덱스 목록을 보았는데 ???????????????????????????????????????????? 테스트를 하면서 만들었던 인덱스는 사라져있고 그 자리에 인덱스 이름부터 날좀보소 하는 인덱스 하나만 남아 있었습니다. 뭐지? 하고 궁금해서 확인해보니 확인에 사용한 검색식 GET /read_me/_search { "q..
gunicorn을 활용하여 Flask로 만든 API를 배포하기 위하여 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app 위의 명령어를 활용하여 실행을 하니 [Ubuntu] ModuleNotFoundError: No module named '_bz2' 해결 방법 우분투에서 아래의 명령어를 통해 api를 gunicorn을 활용하여 띄우려고 할때 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app /usr/local/lib/python3.7/importlib/_bootstrap.py:219: Runtime.. somjang.tistory.com [Ubuntu] UserWarning: ..
Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to the node to be deleted directly. It is guaranteed that the node to be deleted is not a tail node in the list. Example 1: Input: head = [4,5,1,9], node = 5 Output: [4,1,9] Explanation: You are given the second node with value 5, the linked list shoul..
UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError. gunicorn을 사용하던 중 위와 같은 오류가 발생하게 되었습니다. 이를 해결 하는 방법은 다음과 같습니다. $ sudo apt-get install liblzma-dev apt-get install 명령어를 통하여 liblzma-dev를 설치해주면 됩니다. 그 다음 python을 한번 다시 컴파일 해주어야 합니다. 먼저 설치할 때 사용했던 파일들이 있는 디렉토리로 이동합니다. 만약 설치할 때 사용했던 파일들이 있는 디렉토리가 없다면 먼저..
우분투에서 아래의 명령어를 통해 api를 gunicorn을 활용하여 띄우려고 할때 gunicorn --bind 0.0.0.0:5000 -w=2 -k=gevent --threads=2 app:app /usr/local/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: greenlet.greenlet size changed, may indicate binary incompatibility. Expected 144 from C header, got 152 from PyObject return f(*args, **kwds) -- 중략 -- File "/home/azureuser/workplace/projects/QA_Extractor/qna-maker/Qn..
A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements: The area of the rectangular web page you designed must equal to the given target area. The width W should not be larger than the length L, which means L >= W. The differ..
The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance. Note: 0 ≤ x, y < 231. Example: Input: x = 1, y = 4 Output: 2 Explanation: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different. Soltuion class Solution: def hammingDist..
S and T are strings composed of lowercase letters. In S, no letter occurs more than once. S was sorted in some custom order previously. We want to permute the characters of T so that they match the order that S was sorted. More specifically, if x occurs before y in S, then x should occur before y in the returned string. Return any permutation of T (as a string) that satisfies this property. Exam..
Pycharm에서 Start SSH Session을 통하여 서버에 접속하여 사용을 하려고하는데 위와 같이 한글에 대한 정보가 모두 깨져서 나오는 경우가 있습니다. 이는 터미널에 설정되어있는 인코딩 정보가 한글과 맞지 않아 발생하는 문제입니다. 이를 해결하는 방법은 다음과 같습니다. Mac OS 의 경우 먼저 상단 바의 PyCharm을 클릭하고 Preferences... 를 클릭하여 환경 설정 창으로 이동합니다. 환경 설정 창에서 좌측 배너의 Tools > SSH Terminal을 선택하면 나오는 창에서 Default encoding을 UTF-8로 바꾸어 준 뒤 OK를 누르면 됩니다. Windows의 경우 먼저 상단 메뉴에서 File > Settings 를 선택합니다. 그 다음 Mac 과 동일하게 Tool..
Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string. Example 1: Input: S = "loveleetcode", C = 'e' Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0] Note: S string length is in [1, 10000]. C is a single character, and guaranteed to be in string S. All letters in S and C are lowercase. 첫번째 시도 class Solution: def shortest..
with tf.Session() as sess: # Initialize TensorFlow variables sess.run(tf.global_variables_initializer()) sess.run(tf.global_variables_initializer()) for step in range(10001): cost_val, _ = sess.run([cost, train], feed_dict={X: x_data, Y: y_data}) if step % 200 == 0: print(step, cost_val) # Accuracy report h, c, a = sess.run([hypothesis, predicted, accuracy], feed_dict={X: x_data, Y: y_data}) pri..
Given an integer array arr, return the mean of the remaining integers after removing the smallest 5% and the largest 5% of the elements. Answers within 10-5 of the actual answer will be considered accepted. Example 1: Input: arr = [1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3] Output: 2.00000 Explanation: After erasing the minimum and the maximum values of this array, all elements are equal to 2, so ..
Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. Example 1: Input: head = [1,0,1] Output: 5 Explanation: (101) in base 2 = (5) in base 10 Example 2: Input: head = [0] Output: 0 Example 3: Input: head = [1]..
Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits). 345 contains 3 digits (odd number of digits). 2 contains 1 digit (odd number of digits). 6 contains 1 digit (odd number of digits). 7896 contains 4 digits (even number of digits). Therefore only ..
wand 라이브러리 설치 $ pip install wand 위의 라이브러리는 ImageMagick이라는 것을 활용하므로 이것도 같이 설치해주어야 합니다. ImageMagick 설치 Ubuntu 에서 설치하는 방법 sudo apt-get install libmagickwand-dev 위의 명령어로 설치한 이후에 사용할 설정을 수정해주면 완료입니다. [Python] wand.exceptions.PolicyError: not authorized `./test.pdf' @ error/constitute.c/ReadImage/412 해결방법 wand와 ImageMagick을 설치한 후 pdf를 tiff로 변환하려고 할 때 wand.exceptions.PolicyError: not authorized `./test..
wand와 ImageMagick을 설치한 후 pdf를 tiff로 변환하려고 할 때 wand.exceptions.PolicyError: not authorized `./test.pdf'@ error/constitute.c/ReadImage/412 위와 같은 오류를 만나게 되었습니다. 위는 imageMagick의 설정에 pdf 관련 설정이 none으로 설정되어있기 때문입니다. 이를 해결하는 방법은 다음과 같습니다. 먼저 설정을 변경할 파일을 vi 편집기로 열어줍니다. $ sudo vi /etc/ImageMagick-6/policy.xml $ sudo vi /etc/ImageMagick/policy.xml 위의 두 경로 중 본인의 설치 버전에 맞는 버전의 경로로 들어가면됩니다. 여러 부분 중에서 위의 부분을 ..
이 글에서는 자주 사용하는 정규식을 정리하려합니다. XXXX년 XX월 XX일 ( 년 월 일 형식 추출 정규식 ) import re value = "오늘은 2020년 12월 29일 입니다." pattern = r"\d+년 \d+월 \d+일" regex_result = re.search(pattern, value) result = regex_result.group() 특수문자 제거 정규식 import re regex_text = re.sub('[-=+,#/\?:^$.@*\"※~&%ㆍ!』\\‘|\(\)\[\]\`\'…》]', '', text) XX-XXX-XXXX | XX-XXXX-XXXX | XXX-XXX-XXXX | XXX-XXXX-XXXX ( 전화번호 추출 정규식 ) import re value = "내..
Given an array of unique integers salary where salary[i] is the salary of the employee i. Return the average salary of employees excluding the minimum and maximum salary. Example 1: Input: salary = [4000,3000,1000,2000] Output: 2500.00000 Explanation: Minimum salary and maximum salary are 1000 and 4000 respectively. Average salary excluding minimum and maximum salary is (2000+3000)/2= 2500 Examp..
Given two non-negative integers low and high. Return the count of odd numbers between low and high (inclusive). Example 1: Input: low = 3, high = 7 Output: 3 Explanation: The odd numbers between 3 and 7 are [3,5,7]. Example 2: Input: low = 8, high = 10 Output: 1 Explanation: The odd numbers between 8 and 10 are [9]. Constraints: 0
Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. Find the kth positive integer that is missing from this array. Example 1: Input: arr = [2,3,4,7,11], k = 5 Output: 9 Explanation: The missing positive integers are [1,5,6,8,9,10,12,13,...]. The 5th missing positive integer is 9. Example 2: Input: arr = [1,2,3,4], k = 2 Output: 6 Explanation: The miss..
Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: Input: 1->2->3->4->5->NULL, m = 2, n = 4 Output: 1->4->3->2->5->NULL 첫번째 시도 # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseBetween(self, head: ListNode, m: int, n: int) -> ListNode:..
최근 Github이 master branch에서 main branch로 이름이 바뀌면서 git도 업데이트가 필요했습니다. 먼저 본인의 git 버전이 어떤 버전인지 확인해봅니다. $ git version git version 2.7.4 main branch를 기본 branch로 설정할 수있는 git의 버전은 2.28.0 이상이라고 합니다. 업데이트를 하기위해서 $ sudo apt-get upgrade 위의 명령어로 설치를 시도하였으나 실패하여 찾아보니 아래의 방법으로 업데이트가 가능했습니다. $ sudo add-apt-repository ppa:git-core/ppa -y $ sudo apt-get update $ sudo apt-get install git -y 설치 후 다시 git 버전을 확인해보면 $..
1일 1문제 280일차! 오늘의 문제는 프로그래머스의 최고의 집합 문제입니다. 코딩테스트 연습 - 최고의 집합 자연수 n 개로 이루어진 중복 집합(multi set, 편의상 이후에는 집합으로 통칭) 중에 다음 두 조건을 만족하는 집합을 최고의 집합이라고 합니다. 각 원소의 합이 S가 되는 수의 집합 위 조건을 만족 programmers.co.kr Solution def solution(n, s): answer = [] if s // n < 1: answer = [-1] else: s_n = s // n for i in range(n): answer.append(s_n) s_p_n = s % n idx = len(answer) - 1 for i in range(s_p_n): answer[idx-i] = a..