Skip to content

Instantly share code, notes, and snippets.

View guitarrapc's full-sized avatar
:octocat:

Ikiru Yoshizaki guitarrapc

:octocat:
View GitHub Profile
@guitarrapc
guitarrapc / curl_retry.sh
Created April 13, 2023 08:20
curl retry. docker gpg server is unstable these days.... 2023
# connect-timeout: 1s = connect timeout. if network connect is stopped frequentry, 1s will be strong option.
# max-time: 10s = must finish within this time
# retry: 5 = retry count
# retry-delay: 0 = no exponential backoff
# retry max time: 60 = retry no longer than
curl --connect-timeout 1 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 60 -fsSL https://download.docker.com/linux/ubuntu/gpg
@guitarrapc
guitarrapc / README.md
Created April 12, 2023 18:19
Terraform Graph generator and visualizer comparison

tl;dr;

terraform graph ではグラフ表示が厳しすぎる。 もっといい感じにリソースを構成図に落とし込んだり確認したい。

できれば、Pulumi の Graph View がよい。

候補1. terraform-graph-beautifier

pcasteran/terraform-graph-beautifier: Terraform graph beautifier

@guitarrapc
guitarrapc / README.md
Created April 12, 2023 09:46
2023年4月の Agones 事情

Agones

Kubernetes 上に Agones Controller (+ Agones Allocator) を配置して、DGS (Dedicated Game Server = Agones で管理する専用Pod) を確保する。

  • セルフホスト: 自分の Kubernetes Cluster (GKE、EKS、AKS どれでもOK) に Agones をインストールして、Agones Controller 経由でリクエストを投げて DGS を管理していく。
  • マネージド: オワコン気配

Managed Agones

GCPお得意のサービス終了させた気配がある。アナウンスはないようだが、サイレントにしれっと終了っぽい。

@guitarrapc
guitarrapc / AmazonLinux2023_arm64.sh
Last active May 12, 2023 11:36
Get ARM64 Amazon EC2 Images via awscli, pulumi, terraform
# Amazon Linux 2023
# need filter to latest
$ aws ec2 describe-images --owners amazon amazon --filters "Name=name,Values=al2023-ami-2023*-arm64" "Name=virtualization-type,Values=hvm" "Name=architecture,Values=arm64" --query 'reverse(sort_by(Images, &CreationDate))[:5].Name' --output text
# list of amis
$ aws ssm get-parameters-by-path --path "/aws/service/ami-amazon-linux-latest"
# only latest returns (same image id)
$ aws ssm get-parameters --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64 --output text
$ aws ssm get-parameters --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64 --output text
@guitarrapc
guitarrapc / daemonset.yaml
Created March 18, 2023 13:44
Place daemonset without Fargate Node
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: foo-daemonset
spec:
selector:
matchLabels:
k8s-app: foo-daemonset
template:
metadata:
@guitarrapc
guitarrapc / NotionAI.md
Last active March 17, 2023 02:40
Docker and containerd, Kubernetes container runtime difference on stdout output log on node.

Kubernetes のコンテナランタイムが Docker と containerd に変わることでどのような違いが起こるか例を教えてください。

Kubernetesは、コンテナ化されたアプリケーションを管理するためのオーケストレーションツールです。KubernetesがDockerからcontainerdに移行することで、いくつかの違いが生じます。

まず、コンテナイメージの管理方法が異なります。Dockerでは、コンテナイメージをDocker Hubなどのリポジトリからプルして管理しますが、containerdでは、OCI(Dockerの規格)に基づいて、イメージをプルして管理します。

次に、ネットワーク管理の方法が異なります。Dockerでは、Dockerが提供するネットワークドライバーを使用して、コンテナのネットワークを管理しますが、containerdでは、CNI(Container Network Interface)を使用して、ネットワークを管理します。

最後に、ログの管理方法が異なります。Dockerでは、Dockerデーモンがログを収集して管理しますが、containerdでは、コンテナランタイムがログを直接管理します。

// using Amazon;
// using Amazon.Runtime;
// using Amazon.SQS;
// using Amazon.SQS.Model;
// using System.Threading.Tasks;
async Task Main()
{
// for LocalStack
var credentials = new Amazon.Runtime.BasicAWSCredentials("test", "test");
apiVersion: apps/v1
kind: Deployment
metadata:
name: grpcserver
spec:
selector:
matchLabels:
app: grpcserver
replicas: 1
template:
@guitarrapc
guitarrapc / BenchmarkDotnet_Stopwatch.cs
Created February 24, 2023 06:55
Benchmark.NET with Stopwatch
async Task Main()
{
var summary = BenchmarkRunner.Run<BenchmarkTarget>();
// var sw = ValueStopwatch.StartNew();
// await Task.Delay(1 * 1000);
// sw.GetElapsedTime().Dump();
// await Task.Delay(1 * 1000);
// sw.GetElapsedTime().Dump();
// await Task.Delay(1 * 1000);
// sw.GetElapsedTime().Dump();
@guitarrapc
guitarrapc / UrlIsValid.cs
Created December 20, 2022 01:43
C# can treat http://google.com as valid code.
void Main()
{
// ラベル (http:) + コメント (//google.com) になる
http://google.com
// 条件: 何かしらの文or式が下にないとだめ
for (var i = 0; i < 10; i++) {}
}