Skip to content

Instantly share code, notes, and snippets.

@jeshan
jeshan / get-lambda-event-source.js
Last active June 13, 2024 10:25
AWS Lambda: Determine Event Source from event object. Note that this is an approximation as anybody can send a payload that resembles the real thing.
function getLambdaEventSource(event) {
if (event.Records && event.Records[0].cf) return 'isCloudfront';
if (event.configRuleId && event.configRuleName && event.configRuleArn) return 'isAwsConfig';
if (event.Records && (event.Records[0].eventSource === 'aws:codecommit')) return 'isCodeCommit';
if (event.authorizationToken === "incoming-client-token") return 'isApiGatewayAuthorizer';
if (event.StackId && event.RequestType && event.ResourceType) return 'isCloudFormation';
@lukas-h
lukas-h / license-badges.md
Last active July 11, 2024 07:00
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@lxr
lxr / hirschberg.c
Last active January 13, 2023 00:53
Hirschberg's algorithm for global string alignment
/*
* hirschberg.c implements Hirschberg's algorithm for global string
* alignment in C. To test it, compile it with
* `c99 -o hirschberg hirschberg.c` and then run
* `./hirschberg <string1> <string2>`. (hirschberg.c uses
* variable-length arrays, so the 99 standard is necessary.)
*
* Copyright (c) 2015 Lari Rasku. This code is released to the public
* domain, or under CC0 if not applicable.
*/