Skip to content

Instantly share code, notes, and snippets.

Shuichi Ohsawa ohsawa0515

Block or report user

Report or block ohsawa0515

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ohsawa0515 /
Created Jul 5, 2019
List container images that exist on all hosts.
hosts=("" "" "" "")
for host in ${hosts[@]}; do
gcloud container images list --repository=$host/$project --format json | jq -r ".[].name"
ohsawa0515 /
Last active Sep 23, 2018
Lambda function to upload Amazon Athena's history to S3.
# coding:utf-8
from __future__ import print_function
import os, boto3, datetime, csv
s3 = boto3.resource('s3')
athena_client = boto3.client('athena')
today ="%Y%m%d")
s3_bucket = os.environ.get('S3_BUCKET')
max_items = 50
ohsawa0515 / Gemfile
Last active May 24, 2018 — forked from mirakui/Gemfile
AWS S3 read/write Benchmark
View Gemfile
source :gemcutter
gem 'aws-sdk', '~> 2'
View lambda_vuls_scan_1_server.log
START RequestId: 5ee997c9-e338-11e7-bc6e-832244fddbfd Version: $LATEST
time="Dec 17 14:41:32" level=info msg="Validating config..."
time="Dec 17 14:41:32" level=info msg="Detecting Server/Container OS... "
time="Dec 17 14:41:32" level=info msg="Detecting OS of servers... "
time="Dec 17 14:41:32" level=info msg="(1/1) Detected: web001: amazon 2015.09"
time="Dec 17 14:41:32" level=info msg="Detecting OS of containers... "
time="Dec 17 14:41:32" level=info msg="Checking dependencies..."
time="Dec 17 14:41:32" level=info msg="Dependencies ... Pass"
time="Dec 17 14:41:32" level=info msg="Checking sudo settings..."
ohsawa0515 /
Last active Apr 30, 2018
Send metrics of RDS enhanced monitoring(Cloudwatch Logs) to Mackerel host metrics using AWS Lambda.
from __future__ import print_function
from base64 import b64decode
from urllib2 import Request, urlopen
import time
import json
import zlib
from datetime import datetime, timedelta
import boto3
import os
set -eu
curl -s -S -X POST \
-H "X-Api-Key:${api_key}" \
-H 'Content-Type: application/json' \
ohsawa0515 /
Last active Dec 20, 2016
AWS CodeDeployでデプロイに成功した最新リビジョンを取得するbashスクリプト
# To use this script, you need install jq command.
set -u
import boto3, botocore, json
ec2_client = boto3.client('ec2', region_name='ap-northeast-1')
lambda_client = boto3.client('lambda', region_name='ap-northeast-1')
def validation_event(event):
if len(event) == 0:
print 'There is no Event source.'
return False
if not event.has_key("command"):
import boto3, os, json, time
from base64 import b64decode
from urllib2 import Request, urlopen
encrypted_mackerel_api_key = "ENCRYPTED_MACKEREL_API_KEY"
lambda_client = boto3.client('lambda', region_name='ap-northeast-1')
kms_client = boto3.client('kms')
api_key = kms_client.decrypt(CiphertextBlob=b64decode(encrypted_mackerel_api_key))['Plaintext']
ohsawa0515 / fizzbuzz.go
Created Nov 21, 2016
Fizz Buzz golang version.
View fizzbuzz.go
package main
import "fmt"
func main() {
max := 100
for i := 1; i <= max; i++ {
if i % 3 == 0 && i % 5 == 0 {
fmt.Println("Fizz Buzz")
} else if i % 3 == 0 {
You can’t perform that action at this time.