Skip to content

Instantly share code, notes, and snippets.

View VTRyo's full-sized avatar
🍺
I'm a beer taster. I'm loving it

VTRyo VTRyo

🍺
I'm a beer taster. I'm loving it
View GitHub Profile
@VTRyo
VTRyo / check-service.sh
Last active February 17, 2021 04:59
Process monitoring & automatic startup. Also deal with situations where process pids are left behind, such as "dead but pid file exists".
#!/bin/bash
# Tips for you to register with crontab
#
# SHELL=/bin/bash
# PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
# MAILTO=root
# HOME=/
# For details see man 4 crontabs
@VTRyo
VTRyo / autoTweet.gs
Last active November 9, 2019 19:12
Twitter APIを用いたスプレッドシート内にあるツイートを自動投稿する。スプレッドシートの ツール -> スクリプトエディタ から作成すること
// 認証用インスタンス
var twitter = TwitterWebService.getInstance(
'', // 作成したアプリケーションのConsumer Key
'' // 作成したアプリケーションのConsumer Secret
);
// 認証
function authorize() {
twitter.authorize();
}
@VTRyo
VTRyo / config.yml
Created July 17, 2019 06:08
.circleci/config.yml ( CI for RE:VIEW (CircleCI2.0) )
version: 2
jobs:
build:
docker:
- image: vvakame/review:3.1
steps:
- checkout
- run:
name: Build PDF
command: ./setup.sh && REVIEW_CONFIG_FILE=$REVIEW_CONFIG_FILE npm run pdf
@VTRyo
VTRyo / unicorn auto start. init script
Last active November 2, 2018 06:52
unicorn auto start script.
#!/bin/sh
#chkconfig:2345 84 16
#description:unicorn shell
#reference: https://marketing-web.hatenablog.com/entry/unicorn_auto_start
. /etc/rc.d/init.d/functions
NAME="Unicorn"
ROOT_DIR="<INPUT_YOUR_ROOT>"
#!/bin/bash
docker run -i -t -w <container_start_directory> -v <host_mount_directory>:<container_mount_directory> <container_name> /bin/bash
#!/bin/bash
set -eu
URL='https://hooks.slack.com/services/xxxxxxx/xxxxxxx/xxxxxxxxxxxxxxxx'
CHANNEL=${CHANNEL:-'#alert'}
BOTNAME=${BOTNAME:-'monitoring-bot'}
MESSAGE=${MESSAGE:-'This message is test.\n for examle...a, b, c'}
payload="payload={
@VTRyo
VTRyo / td-agent.conf. get production.log
Created May 15, 2018 09:04
for ansible template format
<source>
@type tail
format multiline
format_firstline /^.,/
format1 /^., \[(?<time>[^\.]+).+\][ ]+(?<level>[^ ]+) -- :(?<message>.*)$/
path "log/#{ENV['RAILS_ENV']}.log"
pos_file /var/log/td-agent/rails.log.pos
time_format %Y-%m-%dT%H:%M:%S
tag rails.log
</source>
@VTRyo
VTRyo / mysql5.7 GetPassword
Created April 11, 2018 02:11
mysql5.7 GetPassword
grep 'password is generated' /var/log/mysqld.log | awk -F'root@localhost: ' '{print $2}'
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>blog.vtryo.me</HostName>
<ReplaceKeyWith/>
<HttpRedirectCode>302</HttpRedirectCode>
</Redirect>
@VTRyo
VTRyo / lambda.json
Last active March 28, 2018 14:33
It is used for price notification of AWS. Please change according to your environment and use it.
{
"name": "aws_bill",
"description": "billing!",
"region": "YOUR-REGION",
"handler": "lambda_function.lambda_handler",
"role": "arn:aws:iam::xxxxxxxxxxx:role/lambda_AwsBill",
"timeout": 300,
"memory": 128,
"variables":
{