This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DELETE | |
| FROM log_by_hour | |
| WHERE id IN | |
| ( | |
| SELECT id FROM (SELECT max(id) FROM log_by_hour where time BETWEEN FROM_UNIXTIME(1598927371) AND FROM_UNIXTIME(1598956231) GROUP BY instance_id, cmd_id, time, min, max, avg HAVING count(*) > 1) temp_table | |
| ) | |
| and time BETWEEN FROM_UNIXTIME(1598927371) AND FROM_UNIXTIME(1598956231) | |
| ; | |
| DELETE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def find_closest(): | |
| """ | |
| max_consecutive_cnt == k 인 경우가 여러개 있을 수 있다. 이 중 stone 을 가장 작게 하는 경우를 찾는다. | |
| 일단, max_consecutive_cnt >= k 를 만족하긴 해야한다. 여기를 =mid 로 잡고 | |
| 나머지 한쪽을 mid-1 이나 mid+1 해서 실험하는 용도로 사용한다. | |
| left 는 항상 k에 못미달하는 구간으로(실패) 업데이트시 max_consecutive_cnt < k 일때 left = mid+1 | |
| right 는 항상 k에 도달하는 구간으로(실패) max_consecutive_cnt >= k 에서 업데이트시 right = mid | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pymysql | |
| from settings import db_host, db, db_user, db_password | |
| def executeScriptsFromFile(filename): | |
| # Open and read the file as a single buffer | |
| fd = open(filename, 'r') | |
| sqlFile = fd.read() | |
| fd.close() | |
| # all SQL commands (split on ';') | |
| sqlCommands = sqlFile.split(';') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -a | |
| source ../.env.local | |
| set +a | |
| /Users/jungsublim/.pyenv/versions/anaconda3-5.1.0/envs/cloaweb/bin/celery -A conf.celery worker -l info -B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##################### Grafana Configuration Example ##################### | |
| # | |
| # Everything has defaults so you only need to uncomment things you want to | |
| # change | |
| # possible values : production, development | |
| ;app_mode = production | |
| # instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty | |
| ;instance_name = ${HOSTNAME} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Trie: | |
| head = {} | |
| def add(self, word): | |
| cur = self.head | |
| for ch in word: | |
| if ch not in cur: | |
| cur[ch] = {} | |
| cur = cur[ch] | |
| # *가 있을 경우, 그 단어가 자료구조에 저장되어 있음을 의미 | |
| # *가 없을 경우, 그 단어는 자료구조에 저장되어 있지 않음, 단지 더 긴 단어의 부분으로만 존재함 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Trie: | |
| def __init__(self): | |
| self.head = {} | |
| def add(self, word): | |
| cur = self.head | |
| for ch in word: | |
| if ch not in cur: | |
| cur[ch] = {} | |
| cur = cur[ch] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List | |
| class Solution: | |
| def exist(self, board: List[List[str]], word: str) -> bool: | |
| #dfs | |
| stack = [(0,0,0,set())] | |
| r , c = (len(board) , len(board[0])if board else 0 ) | |
| while stack: | |
| i, j, c , visited= stack.pop() | |
| print(board[i][j]) | |
| if (i,j) in visited: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while true | |
| do | |
| for ((i=52;i<100;i++)); | |
| do | |
| curl -X POST -H "Content-Type: application/json" -d @data.json 10.128.0.22:8080/logs/cloa/$i & | |
| done | |
| sleep 3 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def solution(bridge_length, weight, truck_weights): | |
| # 트럭 대수는 bridge_len 보다 작고, 트럭 무게 합은 weight 보다 작아야함 | |
| bridge = [] | |
| time, cur_weight, interval = 0, 0, 0 | |
| while truck_weights: | |
| if bridge[0][1] < bridge_length and len(bridge) < bridge_length and cur_weight + truck_weights[0] <= weight: # 새로 태우자 |