Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zaccharles on github.
  • I am zaccharles (https://keybase.io/zaccharles) on keybase.
  • I have a public key whose fingerprint is CEEF BBBA BDAC D613 BACD 6949 1153 AEDD 86D0 BD96

To claim this, I am signing this object:

@zaccharles
zaccharles / Handler.cs
Last active January 12, 2019 00:10
blog-warm-lambdas
public class Handler
{
private Guid _id;
public Handler()
{
_id = Guid.NewGuid();
new Thread(Background).Start();
}
private void Background()
{
var count = 0;
var stopwatch = new System.Diagnostics.Stopwatch();
while(true)
{
stopwatch.Restart();
Thread.Sleep(1000);
Console.WriteLine($"{_id} / {count} / {stopwatch.ElapsedMilliseconds}");
@zaccharles
zaccharles / Handler.cs
Created January 12, 2019 13:54
Files survive when your handler doesn't
public class Handler
{
private Guid _variableGuid;
public Handler()
{
_variableGuid = Guid.NewGuid();
Console.WriteLine($"Constructor: {_variableGuid}");
}
@zaccharles
zaccharles / Context Object Timeout.csv
Last active January 12, 2019 15:23
AWS Lambda Context Object and Deadline
Language Deadline Timestamp Remaining Time Function
Node.js - getRemainingTimeInMillis()
Python deadline_ms get_remaining_time_in_millis()
Java - getRemainingTimeInMillis()
Go Deadline() -
C# - RemainingTime
PowerShell - RemainingTime
Ruby deadline_ms get_remaining_time_in_millis()
@zaccharles
zaccharles / launch.json
Last active February 17, 2019 19:39
LambdaRemoteDebug - Example launch.json
{
"version": "0.2.0",
"languageMappings": {
"C#": {
"languageId": "3F5162F8-07C6-11D3-9053-00C04FA302A1",
"extensions": [ "*" ]
}
},
"exceptionCategoryMappings": {
"CLR": "449EC4CC-30D2-4032-9256-EE18EB41B62B",
@zaccharles
zaccharles / ThirdPartyNotices.txt
Created February 19, 2019 08:33
vsdbg 16.0.11220.2 licenses
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
Microsoft .NET Core Debugger Components incorporates components from the projects listed below. Microsoft licenses these components under the Microsoft .NET Core Debugger Components license terms, except as noted. The original copyright notices and the licenses under which Microsoft received such components are set forth below for informational purposes. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
1. .NET Compiler Platform ("Roslyn") (http://roslyn.codeplex.com/)
2. CoreCLR (https://github.com/dotnet/coreclr)
3. CoreFX (https://github.com/dotnet/corefx)
@zaccharles
zaccharles / OrderCreated.cs
Created February 26, 2019 16:01
OrderCreatedContracts
using System;
using JustEat.OrderHolder.Messages.OrderCreatedContracts;
using JustSaying.Models;
namespace JustEat.OrderHolder.Messages
{
public class OrderCreated : Message
{
public string OrderId { get; set; }
public string Source { get; set; }
@zaccharles
zaccharles / serverless.yml
Created October 4, 2019 12:13
Step Functions Asynchronous Communication - Example 1
service: example1
plugins:
- serverless-step-functions
- serverless-iam-roles-per-function
provider:
name: aws
runtime: nodejs10.x
region: eu-west-1
@zaccharles
zaccharles / deprecate-topic.js
Created April 7, 2020 15:57
Deprecate SNS Topic
/*
Problem:
There is an SNS topic that you wish to get rid of so you "deprecate" it.
The idea is to get migrate each subscriber away one by one then eventually
delete the topic.
However, this can be difficult without something stopping new subscribers
from adding new dependencies.
Solution:
This script takes an SNS topic ARN and adds a new statement to its access policy.