Skip to content

Instantly share code, notes, and snippets.

View NeilBostrom's full-sized avatar

Neil Bostrom NeilBostrom

View GitHub Profile
@NeilBostrom
NeilBostrom / GifTools.cs
Last active April 20, 2020 11:45
How to read a GIF loop count correctly
public class GifImageInfo
{
public int Width { get; set; }
public int Height { get; set; }
public bool IsAnimated { get; set; }
public bool IsLooped { get; set; }
public int? LoopCount { get; set; }
public TimeSpan? AnimationLength { get; set; }
public TimeSpan? TotalAnimationLength => IsLooped ? AnimationLength * LoopCount : AnimationLength;
@NeilBostrom
NeilBostrom / AWS4SignerMessageHandler.cs
Last active December 4, 2020 10:30
AWS AWS4Signer HttpClientHandler implementation with GraphQL client example
static async Task Main(string[] args)
{
var options = new GraphQLHttpClientOptions
{
EndPoint = new Uri("https://countries.trevorblades.com/"),
HttpMessageHandler = new AWS4SignerMessageHandler(
new AmazonAppSyncClient(),
"--awsAccessKeyId--",
"--awsSecretAccessKey--")
};
@NeilBostrom
NeilBostrom / CloudFormationModels.cs
Last active June 6, 2018 15:03
Custom resource support for .NET Core Lambda functions
using Amazon.Lambda.Core;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;