ZabbixからSlackへ通知
This file contains 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
version: '3' | |
services: | |
db: | |
container_name: composed-mysql | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql | |
restart: always | |
environment: |
This file contains 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
[user] | |
name = tomoyk | |
email = tomoyuki@koyama.me | |
[color] | |
ui = true | |
[alias] | |
st = status | |
df = diff | |
co = commit | |
br = branch |
This file contains 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 urllib import request | |
import json | |
import time | |
def send_metric(service_name, api_key, payloads): | |
req_url = 'https://api.mackerelio.com/api/v0/services/{}/tsdb'.format(service_name) | |
req_body = json.dumps(payloads).encode('utf-8') | |
req_method = 'POST' | |
req_headers = { |
This file contains 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
labels: | |
app: nginx | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: |
This file contains 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 colored import fg, bg, attr | |
import requests | |
r = requests.get('https://status.classi.jp/') | |
from bs4 import BeautifulSoup | |
soup = BeautifulSoup(r.text, "lxml") | |
status_all = soup.find_all("div", {"class": "component-inner-container"}) | |
for status in status_all: |
This file contains 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
in_txt = '13 5 4 + 3 / 4 * -'.split(' ') | |
symbols = ('+', '-', '*', '/') | |
stack = [] | |
print("input::", ' '.join(in_txt)) | |
for i,_ in enumerate(in_txt): | |
# FOUND NUM | |
if in_txt[i] not in symbols: | |
stack.append(int(in_txt[i])) | |
continue |
This file contains 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
#!/bin/bash | |
user="${1}" | |
host="ldap://example.com" | |
base="dc=example,dc=com" | |
filter1="(& (objectClass=posixAccount) (uid=${user}))" | |
filter2="sshPublicKey" | |
id "$user" >/dev/null 2>&1 | |
RESULT=$(ldapsearch -x -LLL -H "$host" -b "$base" "$filter1" "$filter2" \ |
This file contains 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
#!/usr/bin/env python3.6 | |
def parse_file(file_name: str): | |
import re | |
with open(file_name, "r") as file: | |
file_content = file.read() | |
file_content = re.sub(r"#.*\n(\n)?|server-duid.+;\n", r'', file_content) | |
lease_logs = [fc for fc in re.split(r"\n}\n*", file_content)] |