Skip to content

Instantly share code, notes, and snippets.

@hyukjuns
hyukjuns / azure_function_webhook_slack.py
Created December 17, 2023 11:28
슬랙 웹훅을 위한 Azure function-python 스크립트
import json
import logging
import requests
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
# get event data from acr
logging.info('Python HTTP trigger function processed a request.')
@hyukjuns
hyukjuns / weather.py
Created October 22, 2023 11:57
날씨정보 크롤링
import csv
import requests
from bs4 import BeautifulSoup
def weather_info():
data = requests.get("https://weather.naver.com/")
soup = BeautifulSoup(data.content, 'html.parser')
weather = dict()
for i in range(1,3):
@hyukjuns
hyukjuns / sports_news.py
Created October 22, 2023 11:48
sample crawler
import csv
import requests
from bs4 import BeautifulSoup
def ranking_news(category):
data = requests.get(f"https://sports.naver.com/{category}/index")
soup = BeautifulSoup(data.content, 'html.parser')
rankings = soup.select('ol.news_list li')
news = dict()
@hyukjuns
hyukjuns / ansible.cfg
Created July 8, 2023 10:42
tig stack ansible cfg
# host_key_checking: 호스트 머신의 known_hosts 파일에 등록된 매니지드 노드인지 체크하는것 무시
[defaults]
inventory = ./inventory.ini
host_key_checking=false
# ansible user는 sudo를 사용해 root권한을 가지고 역할을 수행
# become_ask_pass: sudo명령시 비밀번호 물어보지 않음
[privilege_escalation]
become = True
become_method = sudo
@hyukjuns
hyukjuns / inventory.ini
Created July 8, 2023 10:39
tig stack ansible inventory
# ubuntu, centos
[target]
# Ubuntu
<UBUBTU_PRIVATE_IP> ansible_user="" ansible_password=""
# CentOS
<CENTOS_PRIVATE_IP> ansible_user="" ansible_password="" ansible_become_password=""
@hyukjuns
hyukjuns / telegraf.yml
Created July 8, 2023 10:38
tig stack ansible main
---
- name: Install Telegraf Linux
hosts: target
become: yes
tasks:
- name: check distro
debug:
var: ansible_distribution
# Ubuntu
- block:
@hyukjuns
hyukjuns / main.tf
Created July 8, 2023 10:34
tig stack terraform main.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = " ~> 3.0"
}
}
}
provider "azurerm" {
@hyukjuns
hyukjuns / variables.pkr.hcl
Created July 8, 2023 09:16
build image by packer (tig stack) - variables
# === Required ===
# App info
variable "client_id" {
type = string
description = "Applicaion ID"
sensitive = true
}
variable "client_secret" {
type = string
description = "Applicaion Secret"
@hyukjuns
hyukjuns / software.sh
Created July 8, 2023 09:15
install tig stack by bash script
#!/bin/bash
# Input Variable from packer variable
DATABASE=$1
DB_USERNAME=$2
DB_PASSWORD=$3
echo "Scripti Start at $(date '+%Y-%m-%d %H:%M:%S')"
echo
echo "Check input variables"
@hyukjuns
hyukjuns / main.pkr.hcl
Created July 8, 2023 09:13
build image by packer (tig stack) - main
source "azure-arm" "monitor" {
# App info
client_id = "${var.client_id}"
client_secret = "${var.client_secret}"
subscription_id = "${var.subscription_id}"
tenant_id = "${var.tenant_id}"
# Managed Image info
managed_image_resource_group_name = "${var.managed_image_resource_group_name}"
managed_image_name = "${var.managed_image_name}"