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
name: build lint and test | |
on: push | |
jobs: | |
lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 |
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 main | |
import ( | |
"context" | |
"time" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/kafka" | |
"github.com/caarlos0/env" |
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
func sortStringOfInts(unsorted string) (string, error) { | |
unsortedStringElements := strings.Split(unsorted, ",") | |
intSlice := make([]int, len(unsortedStringElements)) | |
for i, s := range unsortedStringElements { | |
intSlice[i], _ = strconv.Atoi(s) | |
} | |
sort.Ints(intSlice) |
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 main | |
import ( | |
"html/template" | |
"net/http" | |
"reflect" | |
) | |
type UserData struct { | |
FullName string `name:"fullname" desc:"Full name"` |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "test.pb-c.h" | |
int main(int argc, const char * argv[]) { | |
Myproto *msg; | |
// the bytes from the combined tracer and msg proto generated from go | |
char msg_bytes[] = { 0xA8, 0x38, 0x01, 0xB2, 0x38, 0x0D, 0x6D, 0x79, 0x20, 0x74, 0x72, 0x61, 0x63, 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0xBA, 0x38, 0x0F, 0x6D, 0x6F, 0x72, 0x65, 0x20, 0x74, 0x72, 0x61, 0x63, 0x65, 0x20, 0x64, 0x61, 0x74, 0x61, 0x08, 0x02, 0x12, 0x07, 0x6d, 0x79, 0x20, 0x74, 0x65, 0x73, 0x74 }; | |
size_t msg_len = sizeof(msg_bytes); |
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
type Config struct { | |
GrpcPort int `config:"default=8080;usage="` | |
UseTLS bool `config:"default=false;usage="` | |
SSLCertFile string `config:"default=ssl.crt;usage=SSL public key file"` | |
SSLKeyFile string `config:"default=ssl.key;usage=SSL private key file"` | |
} | |
type Server struct { | |
conf *Config | |
contentProcessorServer *request_processor.ContentProcessorServer |
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
Pretty-print json: | |
%!python -m json.tool |
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
func ListenAndServeTLS(srv *http.Server, certPEMBlock, keyPEMBlock []byte) error { | |
addr := srv.Addr | |
if addr == "" { | |
addr = ":https" | |
} | |
config := &tls.Config{} | |
if srv.TLSConfig != nil { | |
*config = *srv.TLSConfig | |
} | |
if config.NextProtos == nil { |
NewerOlder