Skip to content

Instantly share code, notes, and snippets.

View axw's full-sized avatar

Andrew Wilkins axw

View GitHub Profile
@axw
axw / v2dump.go
Created August 28, 2018 07:42
Test server for Elastic APM v2 protocol
package main
import (
"compress/gzip"
"compress/zlib"
"context"
"encoding/json"
"flag"
"fmt"
"io"
@axw
axw / main-instrumented.go
Last active May 28, 2018 04:30
Instrumenting an application using net/http and database/sql
package main
import (
"net/http"
"github.com/elastic/apm-agent-go/module/apmhttp"
"github.com/elastic/apm-agent-go/module/apmsql"
_ "github.com/elastic/apm-agent-go/module/apmsql/sqlite3"
)
@axw
axw / gofuzz.go
Created May 3, 2018 02:14
go-fuzz github.com/apm-agent-go/model
// +build gofuzz
package model
import (
"bytes"
"encoding/json"
"github.com/elastic/apm-agent-go/internal/fastjson"
error_processor "github.com/elastic/apm-server/processor/error"
@axw
axw / swagger.yml
Created February 21, 2018 04:45
WIP Swagger spec for APM intake API
swagger: "2.0"
info:
description: Elastic APM intake API
title: Elastic APM
version: "1.0"
schemes:
- http
basePath: "/v1"
paths:
/transactions:
@axw
axw / Main.java
Created June 15, 2017 02:05
Creating NumPy matrices/arrays from Java
public class Main {
public static void main(String []args) throws Exception {
pushy.Client client = new pushy.Client("local:", null);
try {
NumpyModule m = new NumpyModule(client);
System.out.println(m.array(m.mat("1 2; 3 4")));
} finally {
client.close();
}
}
@axw
axw / list subscriptions
Created March 24, 2017 08:13
POC to list tenants and subscriptions, using device code auth with Juju Application ID
package main
import (
"fmt"
"log"
"github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions"
"github.com/Azure/go-autorest/autorest/azure"
@axw
axw / waitflag.go
Created March 2, 2017 11:13
Example of a gnuflag var that supports both --name and --name=value
package main
import (
"fmt"
"time"
"github.com/juju/gnuflag"
)
type waitFlag struct {
@axw
axw / gcc-wrapper
Last active September 2, 2016 03:38 — forked from WebDrake/snapcr
First draft of working snapcraft.yaml
#!/bin/sh
exec $0.real --sysroot=$SNAP $*
@axw
axw / snapcraft.yaml
Created August 30, 2016 04:16
gcc snap
name: gcc
version: 0 # the version of the snap
summary: ...
description: ...
apps:
gcc:
command: usr/bin/gcc --sysroot=/snap/gcc/current
plugs: [home]
package main
import (
"fmt"
"io"
"regexp"
"strings"
"github.com/lestrrat/go-jsschema"
)