PYTHON - LOG 파일명
·
개발/PYTHON
로그를 설정 하고 확인해보니파일명이 원하는대로 저장이 되지 않았다.-rw-r--r-- 1 root root 114 Nov 25 09:43 2024-11-22.log-rw-r--r-- 1 root root 3372 Nov 23 23:30 2024-11-22.log.2024-11-22-rw-r--r-- 1 root root 1051 Nov 23 23:01 2024-11-22.log.2024-11-23-rw-r--r-- 1 root root 1136 Nov 24 23:30 2024-11-22.log.2024-11-24 내가 원하던건 아래와 같은 형태였다.-rw-r--r-- 1 root root 114 Nov 25 09:43 2..
LOG파일 주기 설정
·
개발/기타
쉘 스크립트 생성#!/bin/bash/usr/bin/find '로그경로' -type f -mtime +7 -exec rm {} +위 명령어는 7일 단위로 파일 제거 crontab 설정$ crontab -e'''5 0 * * * '쉘 경로'/shell.sh''' 쉘 권한$ chmod +x '쉘 경로'/shell.sh
PYTHON - LOG파일 일별, 날짜별 생성
·
개발/PYTHON
import datetimeimport loggingimport logging.handlersdef get_logger(name=None): logger = logging.getLogger(name) logger.setLevel(logging.INFO) # 중복 방지 설정 logger.propagate = False # 기존 핸들러 제거 (필요 시) if logger.hasHandlers(): logger.handlers.clear() # log format formatter = logging.Formatter("%(asctime)s | %(levelname)s | %(filename)s:%(lineno)d | %(message)s", datefmt..
MAC - brew install
·
개발/기타
# brew install/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"vi ~/.zshrc# 맨 마지막 줄에 추가 (m1, m2)eval "$(/opt/homebrew/bin/brew shellenv)"# zsh syntax-highlighting & auto-suggestionscd ~/.oh-my-zsh/pluginsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.gitgit clone https://github.com/zsh-users/zsh-autosuggestions.git# echo 명령어 사용echo "s..
PYTHON - 재귀 함수 (피보나치, 하노이의 탑, 최소공배수 등)
·
개발/PYTHON
재귀함수 (recursion)함수 정의 내에 같은 이름의 함수가 올 때 이를 재귀함수라 부른다.반드시 탈출조건이 있어야 stack overflow를 방지할 수 있다.같은 행위가 반복될 때 재귀함수를 사용한다. 순차탐색 def search(li, begin, end, target): if begin > end: return -1 elif target == li[begin]: return begin else: return search(li, begin+1, end, target)li = [1,6,10,7,2,5]target = 10search(li, 0, 5, 10) # 2  2진수 변환 def print_binary(n): if n   배열의 합 li[0]에서 li[n-1] 까지의 합을 ..
ORACLE - ORA-25156 ANSI 조인, (+)
·
개발/ORACLE
ORA-25156old style outer join (+) cannot be used with ANSI joins[99999][25156] ORA-25156: 이전 방식의 포괄 조인(+)은 ANSI 조인과 함께 사용할 수 없음 Position: 8860 위 에러는 ANSI 조인과 (+) 를 같이 사용하면 나는 에러다.ANSI는 ANSI끼리(+)는 (+)끼리 사용하면 된다. 되도록이면 ANSI를 사용하는게 좋다.(+)는 OUTER JOIN 으로 바꾸자
윈도우 choco 설치
·
개발/기타
1. 윈도우 파워쉘을 관리자 권한으로 실행2. 명령어 실행Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))Set-ExecutionPolicy Bypass -Scope Process -ForcePowerShell의 실행 정책을 현재 프로세스 범위에서 강제로 바꿉니다. 실행 정책은 스크립트를 실행하는 규칙을 결정하는데, 이 부분은 Chocolatey 설치 스크립트를 실행하기 위해 필요한 권한 설정입니다. Bypass 는 실행 정책을 무시하고 스크립트를 실행하는 옵션입니다.iex ((New-Object Sy..
MAC m2 mysql 5.7 install
·
개발/기타
# brew install after~ brew install mysql@5.7~ echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc~ source ~/.zshrc~ mysql.server startStarting MySQL SUCCESS!~ mysql -urootWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.42 Homebrew # 5.7 확인Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trad..