Skip to content

Instantly share code, notes, and snippets.

@yyoda
yyoda / tfsetup.sh
Last active October 26, 2020 05:53
How to setup terraform execution environment by AWS.
# see: https://www.terraform.io/docs/backends/types/s3.html
export AWS_PROFILE=xxx
export AWS_REGION=xxx
# AWS S3 Bucket (to persist tfstate)
export AWS_BUCKET=xxx
aws s3api create-bucket --bucket $AWS_BUCKET --create-bucket-configuration LocationConstraint=$AWS_REGION
aws s3api put-bucket-versioning --bucket $AWS_BUCKET --versioning-configuration Status=Enabled
aws s3api put-public-access-block --bucket $AWS_BUCKET --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
@yyoda
yyoda / ffmpeg.sh
Created May 1, 2020 03:58
Recommended compression rate of mov by ffmpeg
ffmpeg -i xxx.mov -crf 30 xxx.mp4
@yyoda
yyoda / ssh-port-foward.md
Created April 14, 2020 01:03
Bastion 経由で特定のサーバーにポートフォワードで接続する方法

postgresql:5432 を localhost:54321 で受ける例

ssh -i ~/.ssh/somekey.pem -L 54321:{postgresql_host_name}:5432 username@{bastion_host_name}

see

@yyoda
yyoda / git-cmd.md
Last active August 4, 2020 06:30
個人的によく使う GIT コマンドの備忘録

ステージングに登録

git add aaa bbb ccc...
git add .

ステージングから外す

git reset HEAD aaa bbb ccc...
@yyoda
yyoda / docker-redis-always-run.sh
Created April 14, 2020 00:50
ホスト起動と同時にデーモンとして自動起動させるコマンドレット
docker run --restart=always -d -p 6379:6379 redis:latest redis-server
@yyoda
yyoda / aws-powershellcore-setup.ps1
Last active April 14, 2020 05:50
How to setup AWSPowershell.NetCore
# Install PowerSehell (Mac)
brew cask install powershell
# Trast PSGallary
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# Install AWSPowerShell
Install-Module -Name AWSPowerShell.NetCore -AllowClobber
Import-Module AWSPowerShell.NetCore
@yyoda
yyoda / confirm-cpu-memory.ps1
Created April 14, 2020 00:40
Powershell で CPU/Memory を確認する方法
gcim Win32_Processor | % { "$($_.NumberOfCores) cores" }
# 4 cores
gcim Win32_OperatingSystem | % { "$([int]($_.TotalVisibleMemorySize/1mb)) Gb" }
# 7 Gb
@yyoda
yyoda / about-semantic-versioning.md
Created April 14, 2020 00:38
セマンティックバージョニングで出てくる [1,2) のような括弧の使い方について
@yyoda
yyoda / dump-dotnet-with-container.md
Created April 14, 2020 00:36
.NETCore 実行中コンテナからダンプを採取して解析するまでの手順

Dump

see https://hub.docker.com/r/yyoda/dotnet-lldb/

Transfer dumpfile from container to host. (at host)

docker cp {CONTAINER_ID}:/tmp/coredump.1 ~

Transfer dumpfile from container to bastion. (at bastion)

scp {IP}:~/coredump.1 .

Launch the analysis container.

@yyoda
yyoda / gist:d3a271257c8bf2264d4c1d6787a7a941
Created April 14, 2020 00:31
Android 実機で Unity プロファイラを回す
予め以下のコマンドで接続しておくこと。
```bash
adb forward tcp:34999 localabstract:Unity-{BundleIdentifier}
```
BundleIdentifier: Project Settings -> Build Settings -> Player Settings -> Other Settings -> Identification -> Package Name