본문 바로가기

전체 글223

맥에서 matplotlib 한글 깨짐 수정 폰트 찾기 https://noonnu.cc/ OFL(오픈폰트 라이선스) 검색해서 다운 여기서는 Pretendard로 선택 경로 탐색 import matplotlib as mpl print(mpl.matplotlib_fname()) print(mpl.get_cachedir()) 폴더에 폰트 넣기 mpl.matplotlib_fname() 로 찾은 경로 ...mpl-data\fonts\ttf 에 다운받은 폰트 추가 폰트 이름 확인 mpl.get_cachedir() 로 찾은 경로 fontlist....json 파일 삭제 파이썬으로 matplotlib 호출 json 파일 다시 생성됨 해당 json 열람해서 방금 추가한 폰트 이름 확인 파이썬 코드에 추가 plt.rc("font", family="Pretendard.. 2024. 4. 19.
맥 스케줄링으로 배치 실행 * 전원 켜고 끄기 예전에는 GUI로 제공되던게 이제는 터미널로 설정해야 한다 켜기와 끄기 시간 셋팅 (월~일) pmset repeat wakeorpoweron MTWRFSU 07:00:00 shutdown MTWRFSU 19:00:00 스케줄 확인 pmset -g sched --- * 크론 실행 안되면? 시스템 설정 > 개인정보 보호 및 보안 > 전체 디스크 접근 권한 > + > 탐색창 나타나면 /usr/sbin/cron 타이핑 해서 크론 선택 --- https://23log.tistory.com/171 2024. 3. 25.
맥에서 기본 파이썬 변경 brew 설치 https://brew.sh/ 파이썬 최신 버전 설치 brew install python 프로필 파일에 라인 추가 vi ~/.zprofile export PATH="$(brew --prefix python)/libexec/bin:$PATH" 프로필 갱신 source ~/.zprofile 버전 확인 python -V --- pip 사용시 문제가 있으면 아래 명령어 실행 python3 -m pip config set global.break-system-packages true 2024. 3. 25.
스플렁크로 리텐션 구하기 | multisearch [ search index="log_pd_com" uri_path=/pd/install earliest=-22d@d latest=-21d@d | eval type="install" ] [ search index="log_pd_com" uri_path=/pd/playing earliest=-21d@d latest=-14d@d | eval type="section_1" ] [ search index="log_pd_com" uri_path=/pd/playing earliest=-14d@d latest=-7d@d | eval type="section_2" ] [ search index="log_pd_com" uri_path=/pd/playing earliest=-7d@d latest=-.. 2024. 2. 14.
비즈니스용 원드라이브 문서 다운로드 from O365 import Account # pip install o365 TENANT_ID = '...' CLIENT_ID = '...' SECRET_ID = '...' # https://developer.microsoft.com/en-us/graph/graph-explorer # 공유 받은 파일 : https://graph.microsoft.com/v1.0/me/drive/sharedWithMe 주소로 쿼리 전송 # 내 파일 : https://graph.microsoft.com/v1.0/me/drives/{drive-id}/items/{item-id}/children 주소로 쿼리 전송 FILE_ID = '...' DRIVE_ID = '...' #응답 항목 중 parentReference crede.. 2024. 2. 13.
스플렁크에서 nps 계산하는 쿼리 https://channel.io/ko/blog/nps_basic 수많은 기업에서 선택한 NPS 알아보기 - 기본편 고객 만족도 지표 고민 중이신가요? 최근 많은 글로벌 기업에서 선택한 NPS의 개념 및 계산 방법부터 장,단점까지 알아보도록 해요. channel.io index="log_test_com" uri_path IN (/test/nps) | stats count by _time, uuid, point | sort - _time `comment("최신 응답이 최상단")` | streamstats count as response_number by uuid `comment("동일 유저의 여러 개 응답에 넘버링")` | where response_number=1 `comment("최신 응답만 필터링").. 2024. 1. 25.
스플렁크 join 대체 https://community.splunk.com/t5/Splunk-Search/Alternative-method-to-using-Join-command/m-p/532978 join은 느리고 결과값 개수가 제한되어 권장되지 않는다 --- 다음 두가지는 결과가 동일하다 join 방식 index="log_pd_com" uri_path IN (/pd/install) | stats dc(clientip) as inst_device by clientip | join type=left clientip [ search index="log_pd_com" uri_path IN (/pd/uninstall) | stats dc(clientip) as uninst_device by clientip] join 대신 stats.. 2024. 1. 22.
스플렁크 서브서치 mylookup.csv 테이블 구조 user_id,username,email 1,user1,user1@example.com 2,user2,user2@example.com 3,user3,user3@example.com 쿼리 a처럼 작성하면 b와 같이 실행된다 쿼리a index=your_index [| inputlookup mylookup | table username ] | stats count 쿼리b index=your_index (username=user1 OR username=user2 OR username=user3) | stats count 2023. 12. 18.
ORM 방식으로 db에 데이터 추가하 # db_connect.py from sqlalchemy import create_engine def get_db_engine(): # 데이터베이스 연결 설정 engine = create_engine( "postgresql://postgres:pw@test.com:5432/db" ) return engine # main.py from sqlalchemy import Column, String from sqlalchemy.orm import sessionmaker, declarative_base from db_connect import get_db_engine # DB 연결 엔진 가져오기 engine = get_db_engine() # sessionmaker : 필수는 아니지만 관리상 권장 Session .. 2023. 12. 15.
keycloak 설치 * 가이드 https://www.keycloak.org/getting-started/getting-started-docker * 도커 컴포즈 version: '3' services: keycloak: image: quay.io/keycloak/keycloak:23.0.0 ports: - "8080:8080" environment: - KEYCLOAK_ADMIN=admin - KEYCLOAK_ADMIN_PASSWORD=admin command: ["start-dev"] * 테스트를 위해 https 요구사항 끄기 (컨테이너 내부에서 실행) cd /opt/keycloak/bin ./kcadm.sh config credentials --server http://localhost:8080 --realm maste.. 2023. 11. 24.
스플렁크 쿼리 결과 가져오기 import requests import pandas as pd from io import StringIO # 자체 인증서 사용시 필요 requests.packages.urllib3.disable_warnings() # 변수 정의 url = "https://splunk.test.com:8089/services/search/v2/jobs/export" #8089 포트 오픈 필요 username = "admin" password = "pw" search_query = "search host=log.test.com | timechart span=1h count" earliest_time = "-1d@d" latest_time = "now" output_mode = "csv" # 데이터 설정 data = { '.. 2023. 11. 10.
다른 PC로 파일 전송 https://news.hada.io/topic?id=11093 Croc - 2개의 컴퓨터간에 안전하고 쉽게 파일전송하기 | GeekNews CLI로 2개의 컴퓨터간 파일 전송(릴레이 사용)PAKE를 이용한 E2E 암호화 지원윈/맥/리눅스 크로스 플랫폼 전송다수 파일 및 폴더 전송 지원중단된 파일 이어받기 가능로컬서버 또는 포트포워딩 필 news.hada.io https://github.com/schollz/croc GitHub - schollz/croc: Easily and securely send things from one computer to another :package: Easily and securely send things from one computer to another :crocodi.. 2023. 10. 13.