Skip to content

Instantly share code, notes, and snippets.

View codefromthecrypt's full-sized avatar

Adrian Cole codefromthecrypt

View GitHub Profile
@codefromthecrypt
codefromthecrypt / main.go
Last active February 5, 2023 12:57
wazero devops win
package main
import (
"context"
_ "embed"
"fmt"
"log"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"

Elasticsearch roles to use for zipkin user if Elasticsearch has the auth enabled

Create a role named as zipkin (use correct auth in -u curl option)

curl -k -X POST -H 'Content-Type: application/json' -u $ELASTIC_USERNAME:$ELASTIC_PASSWORD https://elasticsearch-host:9200/_security/role/zipkin -d'
{
  "indices": [
    {
 "names": [ "zipkin*" ],

Zipkin query optimization

Test setup

  • MariaDB (10.1.23-MariaDB-9+deb9u1)
  • Virtual server (2.5Ghz single core, 3GB RAM)
  • 701,241 spans
  • 3,508,959 annotations

Queries

@frgomes
frgomes / wrap_service_by_logging_filter.scala
Last active June 23, 2017 09:38
Finatra : wrap service by a LoggingFilter
// build.sbt here: https://gist.github.com/frgomes/fb4ca804c21dd14e3224e4fc23d377e6
//TODO: should take configurations from configuration Logger in the environment.
def logWrapper(service: Service[Request, Response]): Service[Request, Response] = {
import com.twitter.logging._
import com.twitter.finagle.http.filter.{CommonLogFormatter, LoggingFilter}
val factory = LoggerFactory(
node = "",
level = Some(Level.TRACE),
handlers = List(
public class HttpClient implements Call.Factory {
private final OkHttpClient ok;
HttpClient(final OkHttpClient ok) {
this.ok = ok;
}
/**
* Returns a CompletableCall, which supports CompletableFuture based enqueueing.
@JakeWharton
JakeWharton / authorpurge.py
Created August 15, 2012 19:29
Purge all @author tags!
#!/usr/bin/env python
import os
import re
os.system('git reset --hard HEAD')
os.system('git clean -fdx')
REs = [
r'''\s+\*\n\s+\* @author[^\n]*''',