전체 글244 비즈니스용 원드라이브 문서 다운로드 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/532978join은 느리고 결과값 개수가 제한되어 권장되지 않는다 --- 다음 두가지는 결과가 동일하다 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 .. 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. 스플렁크 쿼리 결과 가져오기 (python) import requestsimport pandas as pdfrom 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 = { 'search':.. 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. 도커로 postgresql 환경 구축 백업을 위한 볼륨 docker volume create pgdata --- version: '3' services: postgre_my: image: postgres container_name: postgre_my ports: - "8501:5432" environment: POSTGRES_PASSWORD: mypw volumes: - pgdata:/var/lib/postgresql/data pgadmin: image: dpage/pgadmin4 container_name: pgadmin ports: - "8080:80" environment: PGADMIN_DEFAULT_EMAIL: my@test.com PGADMIN_DEFAULT_PASSWORD: mypw depends_on: - postgre_my.. 2023. 9. 5. 깨진 링크 검사기 (broken link checker) gpt 도움으로 작성 import requests import sys from urllib.parse import urlparse, urljoin from bs4 import BeautifulSoup import time # Disable unnecessary warning messages requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) SUPPORTED_SITES = { "1": "https://www.test1.com/", "2": "https://www.test2.com/", "3": "https://www.test3.com/" } EXCLUSION_LIST = .. 2023. 8. 23. 리눅스에서 도커 환경 구축하기 거의 모든 리눅스는 한방 설치 https://github.com/docker/docker-install curl -fsSL https://get.docker.com | sh --- 아마존 리눅스 2 엔진 설치 https://gist.github.com/npearce/6f3c7826c7499587f00957fee62f8ee9 sudo amazon-linux-extras install docker sudo service docker start sudo usermod -a -G docker ec2-user 파이썬 버전이 안맞으면 sudo update-alternatives --config python 부터 설정 컴포즈 설치 플러그인 방식은 안되므로 독립 실행형으로 진행 https://docs.docker.co.. 2023. 8. 11. yield 한 방에 이해하기 지피티가 기가 막히게 설명해주네 비유를 사용하면, return은 책을 읽다가 북마크 없이 닫는 것과 같습니다. 다시 열면 처음부터 시작해야 하죠. 반면, yield는 책에 북마크를 끼워놓고 닫는 것과 유사합니다. 다시 열면 북마크가 있는 곳부터 계속 읽을 수 있습니다. 2023. 8. 4. 이전 1 2 3 4 5 6 ··· 21 다음