Skip to content

Instantly share code, notes, and snippets.

View h-imaoka's full-sized avatar

Hisatoshi Imaoka h-imaoka

View GitHub Profile
@h-imaoka
h-imaoka / pd.py
Created November 12, 2020 02:01
convert get_table -> TableInput dict
#!/usr/bin/env python
import boto3
import botocore
from itertools import product
client = boto3.client('glue')
def get_projected_dict(op_name, pm_name, src_dict, structure=None):
if structure:
@h-imaoka
h-imaoka / Dockerfile-app
Last active October 23, 2018 12:10
Docker Volume & fluent in_tail plugins
FROM python:2.7-alpine
COPY logout.py /app/
COPY config.ini /app/
WORKDIR /app
CMD ["./logout.py"]
@h-imaoka
h-imaoka / ez-mysql.sh
Created June 21, 2018 23:59
easy mysql login via mysql_config_editor
#!/bin/bash
LOGINPATH=`mysql_config_editor print --all | grep '^[[]' | tr -d '[]' | fzf`
mysql --login-path=$LOGINPATH
@h-imaoka
h-imaoka / lambda-ecs-notify.py
Created April 17, 2018 05:28
ecs-event to slack
import os
import logging
import requests
import json
logger = logging.getLogger()
logger.setLevel(logging.INFO)
env_webhook = os.environ['SLACK_WEBHOOK']
env_channel = os.environ['SLACK_CHANNEL']
@h-imaoka
h-imaoka / auto-recovery.sh
Created August 31, 2015 12:42
AWS EC2 auto-recovery
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 [AlarmBaseName] [Region]"
echo "Region: ap-northeast-1 ap-southeast-1 ap-southeast-2 eu-central-1 eu-west-1 sa-east-1 us-east-1 us-west-1 us-west-2"
exit
fi
ALARM_BASE_NAME=$1
METRIC_NAME=StatusCheckFailed_System
@h-imaoka
h-imaoka / flowlogviewer.html
Last active August 29, 2015 14:27
AWS VPC Flowlog Viewer (AWS VPC Flowlogを読みやすくするやーつ)
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Cloud Watch Flowlog</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/r/bs/jq-2.1.4,dt-1.10.8/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/r/bs/jq-2.1.4,dt-1.10.8/datatables.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
@h-imaoka
h-imaoka / checkExpireDate.gs
Created January 24, 2015 13:34
GASでドメイン/SSL証明書の有効期限を確認
/**
* 日付をフォーマットする
* @param {Date} date 日付
* @param {String} [format] フォーマット
* @return {String} フォーマット済み日付
*/
var formatDate = function (date, format) {
if (!format) format = 'YYYY-MM-DD hh:mm:ss.SSS';
format = format.replace(/YYYY/g, date.getFullYear());
format = format.replace(/MM/g, ('0' + (date.getMonth() + 1)).slice(-2));