There are 3 parts that let JS talk to Go:
- The C++ binding
- Installing the binding
- Calling Go
| class BufferedChan<T> { | |
| cap: number | |
| sendx = new Uint32Array(2) | |
| recvx = new Uint32Array(2) | |
| buf: { lap: number, val: T | null }[] | |
| closed = false | |
| // Pending senders/receivers | |
| sendq: Array<() => void> = [] |
| pkgs.stdenv.mkDerivation | |
| { | |
| name = "code-server"; | |
| src = pkgs.fetchurl | |
| ( | |
| let | |
| INSTALL_ARCH = "x86_64"; | |
| INSTALL_TARGET = "unknown-linux-gnu"; | |
| in | |
| { |
| server { | |
| listen = "0.0.0.0:7922" # The default | |
| # Set this to the contents of lazyssh_host_key generated above. | |
| host_key = <<-EOF | |
| -----BEGIN OPENSSH PRIVATE KEY----- | |
| ... | |
| -----END OPENSSH PRIVATE KEY----- | |
| EOF |
| module "nixos_image_20_09" { | |
| source = "../terraform-nixos/aws_image_nixos" | |
| release = "20.09" | |
| } | |
| resource "aws_key_pair" "nix_key" { | |
| key_name = "nix_key" | |
| public_key = file("~/.ssh/aws_nix.pub") | |
| } |
| import { Dice } from 'https://deno.land/x/dodecasaurus/mod.ts'; | |
| import { Node } from 'https://deno.land/x/router/mod.ts' | |
| import { | |
| APIGatewayProxyEvent, | |
| APIGatewayProxyResult, | |
| Context | |
| } from "https://deno.land/x/lambda/mod.ts"; | |
| const root = new Node(); |
| import { | |
| APIGatewayProxyEvent, | |
| APIGatewayProxyResult, | |
| Context | |
| } from "https://deno.land/x/lambda/mod.ts"; | |
| export default async function ( | |
| event: APIGatewayProxyEvent, | |
| context: Context | |
| ): Promise<APIGatewayProxyResult> { |
| FROM alpine:latest | |
| WORKDIR /app | |
| RUN apk add cargo | |
| COPY . . | |
| RUN cargo build --release | |
| CMD ["/app/target/release/hello"] |
| use async_std; | |
| use futures_timer::Delay; | |
| use job_scheduler::{Job, JobScheduler}; | |
| use std::time::Duration; | |
| #[async_std::main] | |
| async fn main() { | |
| let a = async { 1u8 }; | |
| let b = a.await; | |
| let mut sched = JobScheduler::new(); |
| // Put this file alongside your JS code and VS Code will automatically pick it up! | |
| interface Window { | |
| RunKit: GlobalRunKit | |
| } | |
| type GlobalRunKit = { | |
| createNotebook: (options: EmbedOptions) => NotebookEmbed | |
| } | |
| type EmbedOptions = { |