Skip to content

Instantly share code, notes, and snippets.

View jiimaho's full-sized avatar
🎯
Focusing

Jim Aho jiimaho

🎯
Focusing
View GitHub Profile
@jiimaho
jiimaho / .zshrc
Last active October 14, 2023 16:42
List process listening on port
# Below content is in .zshrc file normally under ~/.zshrc
# Do NOT replace your entire .zshrc with this content, but rather pick the pieces and APPEND to your existing .zshrc
# DOTNET
alias dri="dotnet restore --interactive"
alias db="dotnet build"
# K8S
# Usage: kx <context>
kx() {
@jiimaho
jiimaho / Program.cs
Created November 13, 2021 18:23
SimpleDynamoDbQuery - parsing row
var customer = new { CustomerId = row["CustomerId"].S, Name = row["Name"].S };
@jiimaho
jiimaho / Program.cs
Last active November 13, 2021 18:22
SimpleDynamoDbQuery - issue
var queryResponse = await client.QueryAsync(query);
var row = queryResponse.Items.Single();
@jiimaho
jiimaho / Program.cs
Last active November 14, 2021 10:28
SimpleDynamoDbQuery - query
var query = new QueryRequest
{
TableName = "customertestjim",
KeyConditionExpression = "CustomerId = :Id",
ExpressionAttributeValues = new Dictionary<string, AttributeValue>
{
{ ":Id", new AttributeValue { S = "12345" }}
}
};
@jiimaho
jiimaho / Program.cs
Created November 13, 2021 18:05
SimpleDynamoDbQuery - connection
using IAmazonDynamoDB client = new AmazonDynamoDBClient(RegionEndpoint.EUNorth1);
@jiimaho
jiimaho / Program.cs
Last active November 14, 2021 10:20
SimpleDynamoDbQuery - whole
// See https://aka.ms/new-console-template for more information
using System;
using System.Collections.Generic;
using System.Linq;
using Amazon;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.Model;
using IAmazonDynamoDB client = new AmazonDynamoDBClient(RegionEndpoint.EUNorth1);
public async Task FunctionHandler(SQSEvent evnt, ILambdaContext context)
{
// Calling CreateScope() here is required to resolve scoped services correctly
using var scope = ServiceProvider.CreateScope();
await scope.ServiceProvider.GetService<App>().Run(evnt);
}
public class CustomerModel
{
public string CustomerId { get; set; }
public string Name { get; set; }
}
{
"Source": "From AWAS CLI",
"EntityId": "e165a1df-f792-4043-a601-929c1576ee1d"
}
{
"attribute1": {
"DataType": "String",
"StringValue": "value1"
}
}