Skip to content

Instantly share code, notes, and snippets.

package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
)
func main() {
h := md5.New()
@tkhk
tkhk / create_gitlabrunner.yaml
Last active May 16, 2019 05:25
Create gitlab runner on AWS EC2(ubuntu16.04)
AWSTemplateFormatVersion: '2010-09-09'
Description:
GitLab Runner
Parameters:
RunnerToken:
Description: ""
Type: String
VPCID:
@tkhk
tkhk / rails-new.sh
Last active December 23, 2019 05:54
rails new memo
# mysql
# self install webpack
rails new ${RAILS_PROJECT_NAME} \
--database mysql \
--skip-puma \
--skip-action-cable \
--skip-bundle \
--skip-sprockets \
--skip-coffee \
--skip-turbolinks \
@tkhk
tkhk / rails_new_test_options.md
Created December 23, 2019 07:17
rails new した時の --skip-test と --skip-system-test の違い

rails new した時の --skip-test と --skip-system-test の違い

--skip-test--skip-system-test をそれぞれつける時とつけない時で比較した

$ diff -ru nooption skiptest
$ diff -ru nooption skipsystemtest
@tkhk
tkhk / rails_glossary.md
Created May 21, 2020 06:37
Rails機能名備忘録
@tkhk
tkhk / openapi_generator_tips.md
Last active June 9, 2020 06:01
OpenAPI (OpenAPI Generator) 使う時の注意点
  • components は global におく必要がある
  • Schema オブジェクトは title をつけないと, InlineObject${index} のような名前が付けられる
  • csrf のトークンが必要な場合、Configuration で設定(下記参照)
  • 本番・開発環境で URL 変更したい場合、Configuration で設定(下記参照)
const config = new Configuration({
  basePath: 'http://localhost:3000/api',
  headers: {
 "x-csrf-token": document.head.querySelector("meta[name~=csrf-token][content]"))?.content
@tkhk
tkhk / aurora-serverless-5.7.yaml
Last active November 18, 2021 21:16
5.7 互換の aurora serverless は CloudFormation で作成できないため、この yaml は使えない。作成できるようになった時用。
AWSTemplateFormatVersion: 2010-09-09
Parameters:
VpcId:
Type: AWS::EC2::VPC::Id
PrivateSubnetIds:
Type: List<AWS::EC2::Subnet::Id>
RdsAdminName:
Type: String
Default: admin
@tkhk
tkhk / connect-ecs-container.sh
Created December 24, 2021 08:04
Support ECS exec '/bin/sh'
#!/bin/bash
set -eu
function cluster_arn() {
select cluster in $(aws ecs list-clusters --query "clusterArns[*]" --output text)
do
echo ${cluster}
break
done
}

fargate のバインドマウントの所有者の設定が効かない

unicorn コンテナを ECS fargate で起動すると

Errno::EACCES: Permission denied - connect(2) for /var/run/unicorn/unicorn.sock

で起動しなかった。