jq is useful to slice, filter, map and transform structured json data.
brew install jq
| // Sign returns a signature made by combining the message and the signers private key | |
| // With the r.Verify function, the signature can be checked. | |
| func (r *RsaIdentity) Sign(msg []byte) (signature []byte, err error) { | |
| hs := r.getHashSum(msg) | |
| signature, err := rsa.SignPKCS1v15(rand.Reader, r.private, crypto.SHA256, hs) | |
| return | |
| } |
| package main | |
| import ( | |
| "crypto" | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/sha256" | |
| "encoding/base64" | |
| "testing" | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "os" | |
| "os/signal" | |
| "github.com/iovisor/gobpf/bcc" | |
| ) |
| package main | |
| import ( | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/x509" | |
| "crypto/x509/pkix" | |
| "encoding/pem" | |
| "fmt" | |
| "math/big" |
| package main | |
| import ( | |
| "bytes" | |
| "exec" | |
| "log" | |
| "os" | |
| ) | |
| // Pipeline strings together the given exec.Cmd commands in a similar fashion |
| # This is the first stage, for building things that will be required by the | |
| # final stage (notably the binary) | |
| FROM golang | |
| # Copy in just the go.mod and go.sum files, and download the dependencies. By | |
| # doing this before copying in the other dependencies, the Docker build cache | |
| # can skip these steps so long as neither of these two files change. | |
| COPY go.mod go.sum ./ | |
| RUN go mod download |
| # Sample from @citizen428 https://dev.to/citizen428/comment/6cmh | |
| FROM golang:alpine as build | |
| RUN apk add --no-cache ca-certificates | |
| WORKDIR /build | |
| ADD . . | |
| RUN CGO_ENABLED=0 GOOS=linux \ | |
| go build -ldflags '-extldflags "-static"' -o app | |
| FROM scratch | |
| COPY --from=build /etc/ssl/certs/ca-certificates.crt \ |
| package tar_helper | |
| import ( | |
| "archive/tar" | |
| "compress/gzip" | |
| "errors" | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "os" |
| image: gitlab.dev.terastrm.net:4567/terastream/cisco-nso/ci-cisco-nso:4.2.3 | |
| stages: | |
| - build | |
| - mr-robot | |
| variables: | |
| NCS_VERSION: "4.2.3" | |
| DOCKER_REGISTRY: "gitlab.dev.terastrm.net:4567/terastream/cisco-nso" | |
| TARGET_REGISTRY: "repo.dev.terastrm.net:5000/" |