Skip to content

Instantly share code, notes, and snippets.

@aibou
aibou / test.rb
Created February 21, 2019 06:28
Infrastructure as Code by Rubyのために、なんかこういうテンプレートエンジンほしいよね
params = {
task_definition_arn: "",
task_count: 1
}
XXX.new(<<~EOS).render
ecs_parameters do
task_definition_arn #{params[:task_definition_arn].inspect}
task_count #{params[:task_count]} %% unless params[:task_count].nil?
platform_version #{params[:platform_version]} %% unless params[:platform_version].nil?
end
@aibou
aibou / gist:54d45c404bc4a56aceb6dc6244373f43
Last active October 30, 2017 05:55
1秒間に1回、永遠とこれが出続けるglueのログ
17/10/30 05:53:53 INFO Client: Application report for application_1509340182201_0001 (state: RUNNING)
17/10/30 05:53:53 DEBUG Client: client token: N/A diagnostics: N/A ApplicationMaster host: 10.0.0.158 ApplicationMaster RPC port: 0 queue: default start time: 1509341982360 final status: UNDEFINED tracking URL: http://ip-10-0-0-183.us-west-2.compute.internal:20888/proxy/application_1509340182201_0001/ user: root
[toplevel]
tokyo-stacks = opsworks describe-stacks --region ap-northeast-1
tokyo-layers =
!f() {
for stack_id in $(aws opsworks describe-stacks --region ap-northeast-1 --query "Stacks[].StackId" --output text)
do
aws opsworks describe-layers --region ap-northeast-1 --stack-id ${stack_id}
done
}; f
@aibou
aibou / create_vpc.tf
Created December 11, 2015 02:12
terraformでVPC作るやつ
resource "aws_vpc" "loadtest" {
cidr_block = "10.200.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags {
Name = "load-test"
}
}
resource "aws_subnet" "public-loadtest-a" {
@aibou
aibou / ntpd_spec.rb
Created June 30, 2015 07:25
なにか(for amazon linux)
require 'spec_helper'
describe package('ntp') do
it { should be_installed.with_version('4.2.6p5-30.24.amzn1') }
end
# describe service('ntpd') do
# it { should be_enabled }
# it { should be_running }
# end
@aibou
aibou / grafana-image-handler.json
Created April 27, 2015 08:06
sensu + grafana で、hipchatにグラフ画像投下するやつ
{
"handlers": {
"hipchat": {
"type": "pipe",
"command": "/etc/sensu/handlers/hipchat.rb"
},
"grafana-image": {
"type": "pipe",
"command": "/etc/sensu/handlers/grafana-image.rb"
}
@aibou
aibou / functions.sh
Created March 11, 2015 10:20
/etc/init.d/functions の中身(CodeHubで読む用)
# -*-Shell-script-*-
#
# functions This file contains functions to be used by most or all
# shell scripts in the /etc/init.d directory.
#
TEXTDOMAIN=initscripts
# Make sure umask is sane
umask 022
@aibou
aibou / 0_hello.yaml
Last active August 29, 2015 14:15
こういうの欲しい
hello:
method: GET
patterns:
- request:
params:
name: "Tom"
response:
body: "Hello, Tom!"
- request:
params:
@aibou
aibou / hello.go
Created September 9, 2014 08:56
こういう書き方って一般的なのかどうか知りたいです
package main
import (
"fmt"
"errors"
)
func hoge() (string, error) {
return "hello", errors.New("hello err")
}
@aibou
aibou / hab.go
Created July 16, 2014 02:28
ひっとあんどぶろーてきな
package main
import (
"fmt"
)
func countHit(a string, b string) (hits int) {
for i := 0; i < 10; i++ {
if a[i] == b[i] {
hits ++