package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
This file contains hidden or 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
| class TimeoutError extends Error { | |
| error: unknown; | |
| constructor(timeoutMs: number, error: unknown) { | |
| super(`Operation timed out after ${timeoutMs}ms`); | |
| this.name = 'TimeoutError'; | |
| this.error = error; | |
| } | |
| } |
This file contains hidden or 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: Validate Kubernetes YAML | |
| on: [pull_request] | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code |
type readerFunc func(p []byte) (n int, err error)
func (rf readerFunc) Read(p []byte) (n int, err error) { return rf(p) }
func Copy(ctx context.Context, dst io.Writer, src io.Reader) error {
_, err := io.Copy(dst, readerFunc(func(p []byte) (int, error) {
select {
case <-ctx.Done():
return 0, ctx.Err()package main
import (
"bytes"
"errors"
"fmt"
"io"
"log"sudo apt-get update && sudo apt-get upgradesudo apt install curl lsb-releasecurl -L https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-archive-keyring.gpg >/dev/null
This file contains hidden or 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
| dountil() { | |
| s=${SLEEP:-1} | |
| until eval $*; do echo "failed.. retrying in $s sec" && sleep $s; done | |
| } |
This file contains hidden or 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
| athena-bearer() { | |
| curl -H "Authorization: Basic $(echo -n "${ATHENA_CLIENT_ID}:${ATHENA_SECRET}" | base64)" -H 'Content-Type: application/x-www-form-urlencoded' -d "grant_type=client_credentials&scope=athena/service/Athenanet.MDP.*" "${ATHENA_BASE_URL}/oauth2/v1/token" | |
| } |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| cd "$(dirname "$0")" | |
| find internal pkg -type d -print0 | | |
| while IFS= read -r -d '' path; do | |
| rm -f $path/mock_*.go || exit 1 | |
| rm -f $path/mocks.go || exit 1 | |
| mockery --dir $path --inpackage --name '(.*)' --quiet || exit 1 |
This file contains hidden or 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
| const midnightInterval = (fn: ()=>void) => { | |
| const midnight = new Date(); | |
| midnight.setHours( 24 ); | |
| midnight.setMinutes( 0 ); | |
| midnight.setSeconds( 0 ); | |
| midnight.setMilliseconds( 0 ); | |
| const msUntilMidnight = ( midnight.getTime() - new Date().getTime() ) / 1000; | |
| setTimeout(() => { | |
| fn() |
NewerOlder