Skip to content

Instantly share code, notes, and snippets.

View jamisonhyatt's full-sized avatar

Jamison Hyatt jamisonhyatt

View GitHub Profile
@jamisonhyatt
jamisonhyatt / main.go
Created January 28, 2021 21:06
Check Available HDI VM Sizes by Region
package main
import (
"context"
"fmt"
"github.com/Azure/azure-sdk-for-go/profiles/latest/hdinsight/mgmt/hdinsight"
"github.com/Azure/go-autorest/autorest/azure/auth"
"log"
"strings"
)
//The below code is untested - it was modified from working, but non-public code.
// testServer represents an actual running grpc server
type testServer struct {
address string
listener net.Listener
server *grpc.Server
}
@jamisonhyatt
jamisonhyatt / grpc-multi-pkg-protos.go
Created March 22, 2018 02:24
gRPC Client Example
package main
import (
"context"
"fmt"
"log"
"github.com/jamisonhyatt/grpc-multi-pkg-protos/pkg/external/location"
"github.com/jamisonhyatt/grpc-multi-pkg-protos/pkg/weatherman"
desktop "github.com/jamisonhyatt/grpc-multi-pkg-protos/pkg/weatherman/desktop_svc"
@jamisonhyatt
jamisonhyatt / gwmux.go
Created February 9, 2018 09:27
Outgoing GW Metadata
gwmux := runtime.NewServeMux(runtime.WithForwardResponseOption(forwardResponseOption))
func forwardResponseOption(ctx context.Context, w http.ResponseWriter, p proto.Message) error {
for k, v := range w.Header() {
log.Printf("%s=%s\n", k, v)
}
md, ok := runtime.ServerMetadataFromContext(ctx)
if !ok {
@jamisonhyatt
jamisonhyatt / example.go
Last active April 21, 2017 19:16
grpc http mux
package main
var TLS = true
var port = 443
var certificateFile = "./server_localhost.pem"
var keyFile = "./server_localhost.pkcs8key"
func main() {
SetupMuxedServer().Serve()
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.jackson.JacksonJsonFormatter;
import ch.qos.logback.core.Appender;
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.encoder.LayoutWrappingEncoder;
import com.cofi.api.disbursement.util.logging.JsonStacktraceLayout;
@jamisonhyatt
jamisonhyatt / hello-world_hello-world.yml
Last active September 25, 2015 05:21
dropwizard-comsat
template: Hello, %s!
defaultName: Stranger
server:
maxThreads: 200
minThreads: 200
maxQueuedRequests: 9999
requestLog:
appenders: []
httpClient:
maxConnectionsPerRoute: 9999