Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Ikiru Yoshizaki guitarrapc

:octocat:
View GitHub Profile
@guitarrapc
guitarrapc / Program.cs
Created Dec 1, 2022
StackExchange.Redis での KeyPrefix 付きの処理
View Program.cs
using StackExchange.Redis;
using StackExchange.Redis.KeyspaceIsolation;
var connectionStrings = "localhost:6379,ssl=false,password=password";
var connection = ConnectionMultiplexer.Connect(connectionStrings);
// Prefix は DB に対してつけることで透過的に処理される
//var db = connection.GetDatabase(); // Prefix なし
//var db = connection.GetDatabase().WithKeyPrefix(""); // Prefix なしと同じ
var db = connection.GetDatabase().WithKeyPrefix("PREFIX:"); // Prefix あり
@guitarrapc
guitarrapc / UdpServerClient.cs
Created Oct 7, 2022
C# UDP Server and Client sample
View UdpServerClient.cs
async Task Main()
{
using var cts = new CancellationTokenSource();
var host = "127.0.0.1";
var port = 8125;
using var client = new Client(host, port);
using var server = new UdpServer(host, port)
{
View ConsoleApp5.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@guitarrapc
guitarrapc / README.md
Last active Sep 27, 2022
.NET Regular Expression Backtrack ReDos check.
View README.md
View Makefile
CLIBS = ""
foo:
@echo "CLIBS is '${CLIBS}'"
@guitarrapc
guitarrapc / ConsoleApp.csproj
Created Aug 27, 2022
Force delete your images object from ecr repository
View ConsoleApp.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
View DatadogStatsD.Benchmark.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="DatadogSharp" Version="1.5.5.1" />
@guitarrapc
guitarrapc / README.md
Last active Aug 12, 2022
Delete GitHub Actions runs from specific workflow id.
View README.md
mkdir -p foo && cd foo
curl https://gist.githubusercontent.com/guitarrapc/26cf681731965acc12c3cc6b3a867204/raw/indes.js > index.js
npm install @octokit/rest --save

Run Debug on VSCode as NodeJS.

@guitarrapc
guitarrapc / git-sparse-checkout-exclude.yaml
Last active Jul 31, 2022
git sparse checkout on GitHub Actions
View git-sparse-checkout-exclude.yaml
name: "git sparse-checkout (exclude)"
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
sparse-checkout:
runs-on: ubuntu-latest
@guitarrapc
guitarrapc / AcrTask.cs
Last active Jul 15, 2022
Pulumi to create ACR and ACR Task to purge image automatically
View AcrTask.cs
using Pulumi.AzureNative.ContainerRegistry;
using Pulumi.AzureNative.ContainerRegistry.Inputs;
var opt = new CustomResourceOptions { Parent = this };
var cmd = "acr purge --filter 'samples/devimage1:.*' --filter 'samples/devimage2:.*' --ago 0d --untagged --dry-run";
var acr = new Registry("nanika", new RegistryArgs
{
RegistryName = "nantoka",
Sku = new SkuArgs