Skip to content

Instantly share code, notes, and snippets.


Ikiru Yoshizaki guitarrapc

Block or report user

Report or block guitarrapc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
guitarrapc / GenerateTerraform_GuardDuty.cs
Last active Mar 5, 2020
generate terraform guardduty for all region via C# template. (member account is not scoped)
View GenerateTerraform_GuardDuty.cs
void Main()
var awsProviderVersion = "2.51.0";
static string[] GenModules()
return Amazon.RegionEndpoint.EnumerableAllRegions
.Where(x => !IsSpetialRegion(x.SystemName))
View 01_Basic_TryExpressionTree.cs
void Main()
// GOAL: (object target) => (object)((T)target).PropertyName
// target => Convert(Convert(target, MyClass).MyProperty, Object)
Expression<Func<object, object>> expr = target => ((MyClass)target).MyProperty;
// trarget => Convert(Convert(trarget, MyClass).MyProperty, Object)
var type = typeof(MyClass);
View RouteLoggingMiddleware.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace LoggerSample
public class RouteLoggingMiddleware
private readonly RequestDelegate _next;
guitarrapc / Main.cs
Created Jan 15, 2020
Deserialize Pulumi Resource JSON
View Main.cs
void Main()
var json = File.ReadAllText(@"pulumi_20200115.json");
var pulumi = System.Text.Json.JsonSerializer.Deserialize<PulumiResource>(json);
var parents = pulumi.deployment.resources.Select(x => x.parent).Where(x => x != null).ToArray();
var keys = pulumi.deployment.resources.Select(x => x.urn).ToArray();
View DetectEol.cs
public static class DetectEndOfLine
public static EndOfLineStyle Detect(string pathToFile)
int bufl = 0;
var buf = ArrayPool<char>.Shared.Rent(8192);
return DetectCore(pathToFile, buf, bufl);
View TimeOutXunit.cs
[Fact(Timeout = 50)]
public async Task FactTimeout_TimeoutLessThanProcessingTime_ThrowTestTimeoutException()
Action act = () => Task.Delay(5000);
// Trigger the timeout by attempting something that will take too long
await act;
guitarrapc / Sample.runsettings
Last active Dec 13, 2019
dotnet test RunConfiguration
View Sample.runsettings
curl -O
chmod +x redisinsight-linux64
guitarrapc /
Created Dec 11, 2019
Modify NLB Draining manually.
lb=$(kubectl get service $name -o jsonpath="{.status.loadBalancer.ingress[*].hostname}")
arn=$(aws elbv2 describe-load-balancers --query "LoadBalancers[?DNSName=='$lb'].[LoadBalancerArn]" | jq -r '.[][]')
aws elbv2 describe-target-groups --load-balancer-arn $arn | jq -r ".TargetGroups[].TargetGroupArn" | \
xargs -I {} aws elbv2 modify-target-group-attributes --target-group-arn "{}" --attributes Key=deregistration_delay.timeout_seconds,Value=$draining
guitarrapc / UnitTest1.cs
Created Nov 29, 2019
dotnet test / dotnet vstest and console output on success.
View UnitTest1.cs
public class UnitTest1
public UnitTest1(ITestOutputHelper output)
var listener = new TestTraceListener(output);
_output = listener;
class TestTraceListener : TraceListener
You can’t perform that action at this time.