Skip to content

Instantly share code, notes, and snippets.

View edwintye's full-sized avatar

Edwin Tye edwintye

  • ComplyAdvantage
  • London
View GitHub Profile
@edwintye
edwintye / golang_test_main_http_server_main_test.go
Created April 29, 2022 17:38
Example main with chan args test
package main
import (
"errors"
"github.com/stretchr/testify/require"
"net"
"testing"
"time"
)
@edwintye
edwintye / golang_test_main_http_server_main.go
Last active April 29, 2022 17:44
Example main with chan args
package main
import (
"context"
"github.com/gorilla/mux"
"github.com/oklog/run"
"log"
"net/http"
"os"
"os/signal"
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install -y curl python3-pip git
# Install a YAML Linter
ARG yamllint_version=1.26.1
LABEL yamllint_version=$yamllint_version
@edwintye
edwintye / grafana_datasource_test.go
Created March 19, 2021 17:23
Terratest for Prometheus data source in Grafana
package test
import (
"crypto/tls"
"fmt"
"github.com/gruntwork-io/terratest/modules/helm"
http_helper "github.com/gruntwork-io/terratest/modules/http-helper"
"github.com/gruntwork-io/terratest/modules/k8s"
"github.com/gruntwork-io/terratest/modules/random"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@edwintye
edwintye / pipeline.gdsl
Last active December 17, 2021 08:59 — forked from ggarcia24/pipeline.gdsl
GDSL supporting pipeline declarative
package main.resources
//The global script scope
def ctx = context(scope: scriptScope())
//What things can be on the script scope
contributor(ctx) {
method(name: 'pipeline', type: 'Object', params: [body: Closure])
property(name: 'params', type: 'org.jenkinsci.plugins.workflow.cps.ParamsVariable')
property(name: 'env', type: 'org.jenkinsci.plugins.workflow.cps.EnvActionImpl.Binder')
@edwintye
edwintye / golang_docker_interface.go
Created January 27, 2020 08:49
Example golang docker container interface
type DockerContainerInterface interface {
initialize(string, string) error
getImage() error
startContainer() (string, error)
getContainerNetworkInfo() (string, string)
stopContainer() error
}
@edwintye
edwintye / golang_actions.yaml
Created January 27, 2020 07:05
Example golang actions
name: Go
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
redis: [rc, latest, 5.0]
@edwintye
edwintye / docker_redis_go_test.sh
Last active January 27, 2020 10:00
Docker bash script
#!/usr/bin/env bash
IMAGE_VERSION=${1:-rc}
CONTAINER_ID=$(docker run -p 6379 --rm -d "redis:${IMAGE_VERSION}")
PORT=$(docker port "${CONTAINER_ID}" | cut -d ":" -f 2)
echo "go test using port ${PORT} from ${IMAGE_VERSION}"
REDIS_PORT=$PORT go test -v .
@edwintye
edwintye / keybase.md
Last active July 4, 2019 20:53
keybase.md

Keybase proof

I hereby claim:

  • I am edwintye on github.
  • I am edwintye (https://keybase.io/edwintye) on keybase.
  • I have a public key ASDTrHgxZvPRMpKM-6ZtRyRbXUbxLNCGiCsVY3xTEEA5iAo

To claim this, I am signing this object: