Skip to content

Instantly share code, notes, and snippets.

View tomoyk's full-sized avatar
🐳
Containerize

Tomoyuki KOYAMA tomoyk

🐳
Containerize
View GitHub Profile
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomoyk
tomoyk / nsd-logrotate
Created June 30, 2019 02:53
logrotateでnsdをアーカイブするコンフィグ
/var/log/nsd.log
{
notifempty
rotate 60
daily
dateformat .%Y%m%d
copytruncate
nocompress
olddir nsd.old
su nsd nsd
@tomoyk
tomoyk / slack-ssh-notice.bash
Created June 30, 2019 02:22
SSH接続をSlackへ通知するスクリプト
#!/bin/bash
# [how to use]
# 1. put this file as a /etc/ssh/sshrc
# 2. change file permission with "chmod 755 /etc/ssh/sshrc"
PATH=/usr/bin:/bin:/sbin:/usr/sbin
TIME=`LANG=C date "+%Y/%m/%d %X"`
USER=`whoami`
IP=`who | tac | head -n 1 | cut -d'(' -f2 | cut -d')' -f1`
#!/bin/bash
# [how to use]
# 1. put this file as a /etc/ssh/sshrc
# 2. change file permission with "chmod 755 /etc/ssh/sshrc"
PATH=/usr/bin:/bin:/sbin:/usr/sbin
TIME=`LANG=C date "+%Y/%m/%d %X"`
USER=`whoami`
IP=`who | tac | head -n 1 | cut -d'(' -f2 | cut -d')' -f1`
@tomoyk
tomoyk / get-gist-all-files.py
Created June 28, 2019 02:05
Gistにアップロードしたファイルを全て取得してくるスクリプト. 実行前にdatディレクトリを作成しておく.
from urllib import request
import json
def main():
url = 'https://api.github.com/users/tomoyk/gists'
req = request.Request(url)
with request.urlopen(req) as res:
res_body = res.read().decode('utf-8')
dict_res = json.loads(res_body)
@tomoyk
tomoyk / flask-practice01.md
Created June 23, 2019 14:32
FlaskでWebアプリをつくる練習です

Flaskで簡単なWebアプリケーションをつくる

PythonのWebフレームワークであるFlaskを使って簡単なWebアプリケーションを作ってみます。

環境の構築

$ mkdir work_flaskapp
$ cd $_
$ python3 -m venv env
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 = {

LAMP構成でWebアプリをモクモクするメモ

[A] Linux環境の構築

Virtual MachineにUbuntu 18.04 LTSを入れる.

TODO: VMの作り方をまとめる.

[B] LAMP環境の構築