You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An example of building a Python application into a self-contained statically linked binary and packaging it into a container image based on scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[WIP] TypeScript: Creating "Enums" from Tuple of String Literals
Creating Enums from Tuple of String Literals
Description
It is as it sounds: this function will create something similar to an enum (in this case, an object with a null prototype) from a tuple of string literals.
Why?
Even though native enums have some convenient benefits, they can get a little "wordy" when you wish them to work like holders of string constants.
Simple "what's-my-ip" service (think ipify) via Lambda@Edge
Simple "what's-my-ip" service
via Lambda@Edge
Usage
This will return the IPv4 or IPv6 address of the client making the GET request to the domain you specified when making
the CloudFront distribution. If you add an Accept header with application/json present, it will return an json-parseable
object like { "ip": "127.0.0.1" }, but if not specified or text/plain appears before application/json, it will
default to text/plain and just return the IP address like 127.0.0.1 (following standard handling of Accept headers).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to generate a self-signed that is valid for your browser (by creating your custom certificate authority)
If you're using self-signed certificate for your web server on development,
you might know the browser warning saying that your certificate isn't valid.
If like me you had manually added an exception for this certificate error each time it showed up, this gist is for you.
This cheat sheet provides a detailed overview of the exposed lifecycle events
and available commands (and entrypoints) of the Serverless framework, that can
be hooked by plugins (internal and external ones). The document is structured by
the commands invoked by the user.
Lifecycle events are shown as the globally available outer events (all providers)
and sub lifecycle events that are provider specific in the called order. Currently
only the AWS provider is shown. If you have information about the other provider,
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
Request rate limiter
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
Cognito register, validation and login with remember Devices enabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters