When you use JSON to call an API - not a REST API, but something like JSON-RPC - you will usually want to encode one of several possible messages.
Your request body looks like this:
{
"type": "MessageWithA",
#!/usr/bin/env bash | |
# ref: https://cloud.google.com/config-connector/docs/how-to/getting-started | |
export PROJECT_ID=$(gcloud config get-value project) | |
export PROJECT_USER=$(gcloud config get-value core/account) # set current user | |
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)") | |
export IDNS=${PROJECT_ID}.svc.id.goog # workload identity domain | |
export GCP_REGION="us-central1" |
from math import * | |
# a performant solution would store a prefix sum of line lengths to | |
# a sidechannel and then use that to do a bsearch; on the GPU, | |
# you'd do a sum tree / histopyramid as a preprocessing step | |
def find_point(points, d): | |
d = d | |
for i in range(1, len(points)): | |
x0,y0 = points[i-1] | |
x1,y1 = points[i] |