Skip to content

Instantly share code, notes, and snippets.

View maurorappa's full-sized avatar

maurorappa maurorappa

  • zerolatency
  • Asso
View GitHub Profile
@maurorappa
maurorappa / gist:90aa99e9ea5edcb621628f62869341df
Last active January 8, 2024 14:16
[POC] Aeron messaging exporter
package main
// it will 'sniff' all UDP traffic and collect stats for Aeron messaging flows
// https://github.com/real-logic/aeron/wiki/Protocol-Specification
// the output will be a collection of gauges with a label containing src-dst-port like:
// NetStat{traffic="127.0.0.1-40123-127.0.0.1-55755"} 1960
import (
"flag"
"fmt"
@maurorappa
maurorappa / prom_storage_bck.go
Created March 16, 2019 20:19
Prometheus CSV uploader to AWS S3 as external storage
package main
//based on https://github.com/prometheus/prometheus/blob/release-2.8/documentation/examples/remote_storage/example_write_adapter/server.go
import (
"bufio"
"bytes"
"compress/zlib"
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws"
@maurorappa
maurorappa / gist:4f91da3331795b8dd7b089607fd7244d
Last active February 25, 2019 22:49
Prometheus CSV storage
package main
import (
"bufio"
"bytes"
"compress/zlib"
"flag"
"fmt"
"github.com/gogo/protobuf/proto"
"github.com/golang/snappy"
@maurorappa
maurorappa / gist:a126c1577f6e28e177d208cfc1bb1b34
Created December 29, 2018 19:44
Basic parallel execution in Go
package main
import (
"fmt"
"log"
"os"
//"io/ioutil"
"runtime/pprof"
)
func main() {
@maurorappa
maurorappa / deqrize.go
Created October 10, 2018 22:11
decode file from a series of QR code images
package main
import (
"flag"
b64 "encoding/base64"
"fmt"
"github.com/clsung/grcode"
//"github.com/maruel/natural"
"io/ioutil"
"os"
@maurorappa
maurorappa / qrize.go
Created October 10, 2018 22:09
encode file as QRcode image
package main
import (
"flag"
"fmt"
b64 "encoding/base64"
"github.com/skip2/go-qrcode"
"math"
"os"
//"strconv"
@maurorappa
maurorappa / memhog.go
Last active March 31, 2019 20:51
Memory test containter, it ramps up memory usage as you want
/*
====================================
Build it as standalone binary :
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o memhog memhog.g
====================================
Build its container :
FROM scratch
@maurorappa
maurorappa / monitor.go
Created February 20, 2018 20:55
utility to check an output file and stop the program when the desired size is reached
// This utility allows you to run a command which produce a file and interrup it when a certain size is reached
package main
import(
"flag"
"fmt"
"log"
"os"
"os/exec"
"time"
@maurorappa
maurorappa / docker-cleanup.go
Created December 20, 2017 16:40
Docker cleanup tool for old versions
package main
import (
"flag"
"fmt"
"os"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
@maurorappa
maurorappa / testinfra_generic_script.py
Created November 30, 2017 16:22
Testinfra generic validation script
# scenario: you have a container which has a programming environment (node,python,java) and you want to run Testinfra (or Molecule) to verify is set up properly
# This script will copy the test code in the container, run it and compare its output
# invocation:
# INTERPRETER=node TEST_PROGRAM=test.js EXPECTED_OUTPUT="Hello World" testinfra -v --connection docker --hosts=nodejs
# or
# INTERPRETER=/tools-copy/java/bin/java TEST_PROGRAM=HelloWorld.java EXPECTED_OUTPUT="Hello, World" testinfra -v --connection docker --hosts=maven
import os
import pytest
import testinfra