Skip to content

Instantly share code, notes, and snippets.

// Adds, then removes an alias IP from a VM
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"time"
@droyo
droyo / grpc-generate-access-token.go
Created December 26, 2019 23:19
GCP iamcredentials.googleapis.com GenerateAccessToken GRPC example
package main
import (
"log"
"flag"
"path"
"time"
"context"
"github.com/kr/pretty"
(* service definition
message SeekRequest {
string subscription = 1;
oneof target {
google.protobuf.Timestamp time = 2;
string snapshot = 3;
}
}
message SeekResponse {
}
Fmt.(pf ppf "type %s = {@[<v>@,%a@;<1 -2>@]}" name (list ~sep:(any ";@ ") gen_record_field))
result:
type t = {
bar : BarEnum;
baz : BazMsg;
bum : BazMsg.Data;
foomap : (BarEnum * BazMsg)
}
@droyo
droyo / ast.ml
Created February 19, 2021 03:44
type t = term list
and term =
| Int of int
| Bool of bool
| Float of float
| Id of string
| Str of string
| Expr of t
(* pp_term calls pp *)
// Code generated by xsdgen. DO NOT EDIT.
package ws
// Must be at least 1 items long
type Email string
// Must be at least 1 items long
type ВерсПрог string
// Code generated by xsdgen. DO NOT EDIT.
package ws
import (
"bytes"
"encoding/xml"
)
type Anon1 string
@droyo
droyo / ddex.go
Created November 1, 2020 01:23
output for go-xml issue #123
// Code generated by xsdgen. DO NOT EDIT.
package ws
import (
"bytes"
"encoding/xml"
"time"
)
let decode = Angstrom.(
advance 2 >>= fun () -> (* skip length prefix *)
LE.any_uint16 >>= fun s_type ->
LE.any_int32 >>= fun s_dev ->
Qid.decode >>= fun s_qid ->
LE.any_int32 >>= fun s_mode ->
LE.any_int32 >>= fun s_atime ->
LE.any_int32 >>= fun s_mtime ->
LE.any_int64 >>= fun s_length ->
decode_string >>= fun s_name ->
// Adds, then removes an alias IP from a VM
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"time"