Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Ikiru Yoshizaki guitarrapc

:octocat:
View GitHub Profile
@guitarrapc
guitarrapc / git-lfs-files.sh
Created Dec 4, 2020
List Top 10 of largest git-lfs managed files.
View git-lfs-files.sh
git ls-files -z | xargs -0 stat -c '%s %n' | sort -n | tail -n 10
View EchoGrpcMagicOnion.Client.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ConsoleAppFramework" Version="2.4.0" />
View EchoGrpcMagicOnion.Shared.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MagicOnion" Version="4.0.0-preview.1" />
<PackageReference Include="MagicOnion.Abstractions" Version="4.0.0-preview.1" />
</ItemGroup>
View EchoGrpcMagicOnion.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<Protobuf Include="Protos\aws.proto" GrpcServices="Server" />
</ItemGroup>
@guitarrapc
guitarrapc / service.yaml
Last active Oct 7, 2020
NLB with ACM assigned and TargetGroup TLS.
View service.yaml
apiVersion: v1
kind: Service
metadata:
name: webserver-svc
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:ap-northeast-1:123456789012:certificate/abcd1234-abcd-abcd-abcd-12345678abcd
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
# service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https" # this also works.
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: ssl
@guitarrapc
guitarrapc / get_all_roles.sh
Last active Sep 9, 2020
List all Kubernetes Resources that can define on Role/ClusterRole.
View get_all_roles.sh
#!/bin/bash
_list=($(kubectl get --raw / |grep "^ \"/api"|sed 's/[",]//g'));
for _api in ${_list[@]}; do
_aruyo=$(kubectl get --raw ${_api} | jq .resources);
if [ "x${_aruyo}" != "xnull" ]; then
echo;
echo "# ${_api}";
kubectl get --raw ${_api} | jq -r ".resources[].name";
fi;
done
View Alias.ps1
Get-Alias | ft name, ResolvedCommandName
Name ResolvedCommandName
---- -------------------
? Where-Object
% ForEach-Object
cd Set-Location
chdir Set-Location
clc Clear-Content
clhy Clear-History
@guitarrapc
guitarrapc / configmap-ds1.yaml
Last active Aug 29, 2020
Generate Configmap for each dashboard json based on file name.
View configmap-ds1.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: dashboard
labels:
grafana_dashboard: 1
data:
dashboard.json: |
{
"id": null,
View Get-ListenProcessByPort.ps1
$port = 8080
(Get-NetTCPConnection -LocalPort $port -State Listen).OwningProcess | %{Get-Process -Id $_}
# RESULT
# Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
# ------- ------ ----- ----- ------ -- -- -----------
# 202 29 1580 5432 0.02 18228 1 wslhost
# 307 38 22840 22220 3.58 17372 1 com.docker.backend
@guitarrapc
guitarrapc / Class1.cs
Last active Jul 28, 2020
null conditional operator ?. for struct
View Class1.cs
using System;
namespace ClassLibrary1
{
public class Class1
{
private static void Main(string[] args)
{
// enabled nullable reference type
A? a = new A(null);
You can’t perform that action at this time.