Skip to content

Instantly share code, notes, and snippets.

Joel Takvorian jotak

Block or report user

Report or block jotak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jotak
jotak / md-crd.yaml
Created Oct 7, 2019
Monitoring dashboards new CRD
View md-crd.yaml
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: monitoringdashboards.monitoring.kiali.io
labels:
app: kiali
version: ${OPERATOR_VERSION_LABEL}
spec:
group: monitoring.kiali.io
@jotak
jotak / jvm-dashboard.json
Created Sep 20, 2019
Dummy JVM Grafana dashboard
View jvm-dashboard.json
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@jotak
jotak / dashboard.json
Created Sep 16, 2019
Dummy Grafana App Dashboard
View dashboard.json
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@jotak
jotak / README.md
Created Jun 24, 2019
Prometheus pod behind basic-auth nginx sidecar
View README.md

There's a simple docker image that contains pre-configured nginx proxy for prometheus, with a Basic Authentication with admin/admin credentials: jotak/nginx-basicauth-sidecar. It listens on 8080 and redirect to 9090 (where prometheus is expected to be). To rebuild the image, take a look at https://github.com/eicnix/sidecar-proxy-example

Steps

  • Modify your prometheus deployment and add this container description:
        - image: jotak/nginx-basicauth-sidecar
          imagePullPolicy: IfNotPresent
@jotak
jotak / index.md
Last active Mar 26, 2019
Missing some meta-programming in Go
View index.md

One issue I'm currently facing in Go (looks like it's not an isolated problem) is the lack of meta-programming.

I want to create a simple function that turns any slice into a map, being provided a key-getter function.

I wish I could write something like this:

type KeySupplier<T> func(obj T) string

func Index<T>(arr []T, keySupplier KeySupplier<T>) map[string]T {
@jotak
jotak / index.js
Last active Jun 28, 2018
Reproducer - react-ace issue #300
View index.js
import React, { Component } from 'react';
import { render } from 'react-dom';
import AceEditor from '../src/ace.js';
import 'brace/mode/yaml';
import 'brace/theme/eclipse';
/*eslint-disable no-alert, no-console */
const yamlSource1 = `Initial
text`;
@jotak
jotak / index.adoc
Created Jun 18, 2018
vertx mm metrics doc
View index.adoc

Vert.x Micrometer Metrics

This project is an implementation of the Vert.x Metrics Service Provider Interface (SPI). It uses Micrometer for managing metrics and reporting to several backends.

Features

  • Vert.x core tools monitoring: TCP/HTTP client and servers, {@link io.vertx.core.datagram.DatagramSocket} , {@link io.vertx.core.eventbus.EventBus} and pools

  • User defined metrics through Micrometer

@jotak
jotak / file.tsx
Created May 30, 2018
min/max errors
View file.tsx
const len = dataRps.length;
let minRps: number = len > 1 ? +dataRps[1] : 0;
let maxRps: number = minRps;
let errSample: number = dataErrors.length > 1 ? +dataErrors[1] : 0;
let pctMinErr: number = 100 * errSample / minRps;
let pctMaxErr: number = pctMinErr;
for (let i = 2; i < len; ++i) {
const sample: number = +dataRps[i];
minRps = sample < minRps ? sample : minRps;
@jotak
jotak / file.go
Created May 29, 2018
branch coverage
View file.go
var countHistograms, countGauges uint32
api.SpyArgumentsAndReturnEmpty(func(args mock.Arguments) {
query := args[1].(string)
assert.IsType(t, v1.Range{}, args[2])
r := args[2].(v1.Range)
assert.Contains(t, query, "svc.ns.svc.cluster.local")
assert.Contains(t, query, "[1m]")
if strings.Contains(query, "histogram_quantile") {
View gist:0af19302c93f8df9cc5937715122771f
[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ vertx-rx-java ---
[INFO] io.vertx:vertx-rx-java:jar:3.6.0-SNAPSHOT
[INFO] +- io.vertx:vertx-rx-java-codegen:jar:3.6.0-SNAPSHOT:compile
[INFO] | \- io.reactivex:rxjava:jar:1.3.5:compile
[INFO] +- io.vertx:vertx-core:test-jar:tests:3.6.0-SNAPSHOT:test
[INFO] | +- io.netty:netty-common:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-buffer:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-transport:jar:4.1.19.Final:compile
[INFO] | +- io.netty:netty-handler:jar:4.1.19.Final:compile
[INFO] | | \- io.netty:netty-codec:jar:4.1.19.Final:compile
You can’t perform that action at this time.