Skip to content

Instantly share code, notes, and snippets.

View bwplotka's full-sized avatar
💪
Coding.. Building.. Deploying!

Bartlomiej Plotka bwplotka

💪
Coding.. Building.. Deploying!
View GitHub Profile
@bwplotka
bwplotka / gitbigobj.sh
Created January 5, 2021 10:56
List biggest objects in your git history to answer question: "Why my git repo is so large even though I have only small files in main/master?"
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# set the internal field separator to line break, so that we can iterate easily over the verify-pack output
@bwplotka
bwplotka / e2e_store_and_querier.test
Created December 8, 2020 16:09
e2e benchmarking Thanos run up.
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package e2e_test
import (
"context"
"fmt"
"net"
"net/http"
@bwplotka
bwplotka / bucket_test.go
Last active December 19, 2020 09:52
Thanos Go Benchmarks Real Block Queries
// Copyright (c) The Thanos Authors.
// Licensed under the Apache License 2.0.
package manual
import (
"context"
"io/ioutil"
"os"
"testing"
@bwplotka
bwplotka / bench.sh
Last active November 17, 2020 19:21
Bartek's YOLO Go benchmarking scripts.
#!/usr/bin/env bash
set -e
# Copyright (c) Bartłomiej Płotka @bwplotka
# Licensed under the Apache License 2.0.
# Yolo script allowing nice benchmark framework for iterative work on Go performance.
# Requirements:
# * Prepare worktree if you want to benchmark in background: git worktree add ../thanos_b yolo
@bwplotka
bwplotka / replayable.go
Last active May 14, 2020 17:17
Go Replayable io.Reader: Useful when you want to share slice of bytes across many io.Reader sequential consumers). E.g the same reqest.Body in HTTP server used by multiple RoundTrippers (!).
package replayable
import (
"bytes"
"io"
)
type Reader struct {
wrapped io.Reader
@bwplotka
bwplotka / defer_benchmark.go
Last active February 20, 2020 11:53
Showcase of Go "1.14beta1" vs "1.13.1" `defer` performance improvement.
package main
import (
"testing"
)
var sink1 = 0
func BenchmarkNotDefered(b *testing.B) {
for n := 0; n < b.N; n++ {
@bwplotka
bwplotka / keybase.md
Created August 13, 2019 18:59
Keybase.io

Keybase proof

I hereby claim:

  • I am bwplotka on github.
  • I am bwplotka (https://keybase.io/bwplotka) on keybase.
  • I have a public key ASBF3WaAmnBy4NO6giWMh5EvF0VTevLiRedpJYGZzb4fawo

To claim this, I am signing this object:

@bwplotka
bwplotka / demo-lib.sh
Last active January 28, 2019 21:25
Shell script helper for interactive demos.
#!/usr/bin/env bash
# Script inspired by https://github.com/paxtonhare/demo-magic
# (https://github.com/paxtonhare/demo-magic/issues/15)
#
# Example usage in script:
# #!/usr/bin/env bash
#
# . demo-lib.sh
#
package store
import (
"context"
"io/ioutil"
"os"
"path/filepath"
"testing"
"time"
@bwplotka
bwplotka / ttest.go
Created January 7, 2019 14:38
Table test initial boilerplate
for _, tcase := range []struct{
}{
{
},
}{
if ok := t.Run("", func(t *testing.T) {
}); !ok {
return