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 / eks_addon_configurationvalues_coredns.json
Created April 9, 2024 07:22
EKS Addon Additional Configurations for CoreDNS. Do not place CoreDNS to Karpenter Managed Node. https://aws.amazon.com/jp/blogs/containers/amazon-eks-add-ons-advanced-configuration/
{
"affinity": {
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "karpenter.sh/nodepool",
"operator": "DoesNotExist"
@guitarrapc
guitarrapc / README.md
Last active March 26, 2024 02:56
ShellScript to assume role by single command
  1. Prepare profile in ~/.aws/credentials.
  2. Change from_profile and to_profile to your profile name, then Run command.
from_profile=profile-A to_profile=profile-B sts=$(aws sts assume-role --profile "${from_profile}" --role-arn $(aws configure get "${to_profile}.role_arn") --role-session-name "${to_profile}-assume"); \
export AWS_ACCESS_KEY_ID=$(echo "${sts}" | jq -r '.Credentials.AccessKeyId'); \
export AWS_SECRET_ACCESS_KEY=$(echo "${sts}" | jq -r '.Credentials.SecretAccessKey'); \
export AWS_SESSION_TOKEN=$(echo "${sts}" | jq -r '.Credentials.SessionToken') \
export AWS_EXPIRE=$(echo "${sts}" | jq -r '.Credentials.Expiration')
@guitarrapc
guitarrapc / enumerate_txt.sh
Created March 12, 2024 03:34
Enumerable files under
#!/bin/bash
set -e
extension="txt"
result=$(find . -type f -name "*.${extension}" | cut -d / -f 2 | sort -u)
if [[ -n "$result" ]]; then
while read -r item; do
echo "$PWD/$item"
done <<< "$result"
@guitarrapc
guitarrapc / Get-DockerMemoryStatus.ps1
Last active January 25, 2024 06:21
Get docker memory status for Windows running Docker Desktop for Windows.
$reservedMemoryMB = Get-Content -Raw -Path "${env:APPDATA}/Docker/settings.json" | ConvertFrom-Json | Select-Object -ExpandProperty memoryMiB
$dockerStats = docker stats --no-stream --format "{{.MemUsage}}"
$totalMemoryKB = 0
foreach ($line in $dockerStats) {
$memoryUsage = $line.Split('/')[0].Trim()
$value = [double]($memoryUsage -replace '[^\d.]')
if ($memoryUsage -match "GiB") {
$totalMemoryKB += $value * 1024 * 1024
} elseif ($memoryUsage -match "MiB") {
@guitarrapc
guitarrapc / README.md
Created January 25, 2024 02:46
Docker Dekstop for Windows. %APPDATA%\Docker\settings.json files for Docker Engine backend with Hyper-V or WSL2

tl;dr;

%APPDATA%\Docker\settings.json file for Docker Engine backend with Hyper-V or WSL2.

Environment

Windows 11 Pro 22H2

$ wsl --version
@guitarrapc
guitarrapc / README.md
Last active January 25, 2024 02:15
Docker Dekstop for Windows. http://127.0.0.1:2375/info response for Docker Engine backend with Hyper-V or WSL2.

tl;dr;

http://127.0.0.1:2375/info response for Docker Engine backend with Hyper-V or WSL2.

Environment

Windows 11 Pro 22H2

$ wsl --version
@guitarrapc
guitarrapc / Datadog.md
Created December 8, 2023 02:47
Datadog Metrics and Logging Structure

メトリクス

flowchart LR

subgraph ContainerA
    Application["App"]
end
subgraph ContainerB
    DatadogAgent["ddagent"]
end
@guitarrapc
guitarrapc / RegexMatchSample.cs
Created October 4, 2023 07:49
Regex match example with some Unity Headless log.
void Main()
{
var messages = new[] {
"Invalid VFX Particle System. It is skipped.",
"WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?",
"WARNING: Shader Did you use #pragma only_renderers and omit this platform?",
"ERROR: Shader Sniper/InvisibleShadowCasterUniversalRP shader is not supported on this GPU (none of subshaders/fallbacks are suitable)",
"ERROR: Shader Hidden/Universal Render Pipeline/Foobar shader is not supported on this GPU (none of subshaders/fallbacks are suitable)",
"WARNING: Shader Unsupported: 'SineVFX/FooEffects/SG/DissolveParticleFlip' - All subshaders removed",
};
@guitarrapc
guitarrapc / ProjectVersion.txt
Last active November 27, 2023 11:36
Extract UnityVersion from ProjectVErsion.txt
m_EditorVersion: 2021.3.17f1
m_EditorVersionWithRevision: 2021.3.17f1 (3e8111cac19d)
<#
.SYNOPSIS
Update all dotnet tools installed on the system.
See https://learn.microsoft.com/en-us/dotnet/core/tools/global-tools for dotnet-tools.
.EXAMPLE
# Update Project's dotnet tools
Update-DotnetTools
# Update Global dotnet tools
Update-DotnetTools -Global
#>