Skip to content

Instantly share code, notes, and snippets.

@9bo9bo
9bo9bo / template.yaml
Created July 25, 2023 19:50
良く使うSAM Template
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Lambda Template
Globals:
Function:
Runtime: python3.10
Timeout: 30
Tracing: Active
@9bo9bo
9bo9bo / tunnel.sh
Last active April 21, 2022 07:07
IPアドレスで制限されているWebサーバへ踏み台サーバを経由して接続する
#
# IPアドレスで制限がかかっているWebサーバへ踏み台サーバを経由して接続する(CIなどでの利用を想定しています)
#
# 踏み台サーバの名前解決
echo '172.16.0.1 bastion' >> /etc/hosts
# SSH鍵で接続できるように
eval $(ssh-agent -s)
mkdir -p ~/.ssh
@9bo9bo
9bo9bo / 100-crond.sh
Last active January 10, 2022 05:47
nginx コンテナで crond を起動して log rotate
#!/bin/sh -eux
# /docker-entrypoint.d/100-crond.sh
# see https://docs.docker.com/config/containers/multi-service_container/
busybox crond -f &
busybox crontab -l
exit 0
@9bo9bo
9bo9bo / fluentd.conf
Created January 4, 2022 21:08
json形式で出力されたnginxのログをfluentdで処理する
<source>
@type tail
path "/var/log/nginx/access.log"
tag nginx.access.log
<parse>
@type json
time_format %iso8601
# time field を残すため
keep_time_key true
</parse>
@9bo9bo
9bo9bo / Command.php
Last active September 27, 2021 14:06
onOneServer未対応のLaravelでSignleServerでCommandを実行する
<?php
namespace App\Console;
use Illuminate\Console\Command as BaseCommand;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
abstract class Command extends BaseCommand
{
@9bo9bo
9bo9bo / default.conf
Created July 24, 2021 14:22
[nginx]アクセスログを日付ごと(YYYYMMDD)に出力する
server {
listen 80;
server_name localhost;
if ($time_iso8601 ~ "^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})") {}
access_log /var/log/nginx/access-$year-$month-$day.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
@9bo9bo
9bo9bo / jq.sh
Last active July 19, 2021 13:23
ECS/Fargate環境で実行中のコンテナ内で自身のタスクIDを取得する
export CONTAINER_TASK_ID=$(curl -s ${ECS_CONTAINER_METADATA_URI}/task | jq -r '.TaskARN | split("/") | .[2]')
@9bo9bo
9bo9bo / setup.sh
Last active December 15, 2020 12:23
gitlab-runner
mkdir config
docker run -d --name gitlab-runner --restart always \
-v ${PWD}/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
docker exec gitlab-runner gitlab-runner register \
--non-interactive \
--url "https://gitlab.com/" \
@9bo9bo
9bo9bo / .Brewfile
Last active September 11, 2020 07:28
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"
brew "awscli"
brew "composer"
brew "git"
brew "htop"
brew "jq"
brew "mysql-client"
@9bo9bo
9bo9bo / articles.ipynb
Created February 24, 2020 08:11
Customize WordCloud
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.