Skip to content

Instantly share code, notes, and snippets.

View mniewrzal's full-sized avatar

Michał Niewrzał mniewrzal

View GitHub Profile
// Copyright (C) 2023 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"context"
"fmt"
"os"
"sync"
func TestAbc(t *testing.T) {
filter := gcbf.NewOptimalMaxSize(800000, 0.1, 2*memory.MiB)
for i := 0; i < 800000; i++ {
filter.Add(testrand.PieceID())
}
buffer := bytes.NewBuffer([]byte{})
writer := zip.NewWriter(buffer)
entryWriter, err := writer.Create("test")
require.NoError(t, err)
{
"processes": {
"storagenode": {
"minimum": {
"version": "v0.3.3",
"url": "https://github.com/storj/storj/releases/download/v0.3.4/storagenode_{os}_{arch}.exe.zip"
},
"suggested": {
"version": "0.19.5",
"url": "https://storj-v3-alpha-builds.storage.googleapis.com/bd6d26a-v0.19.5-go1.12.9/storagenode_{os}_{arch}.zip"
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"bytes"
"context"
"fmt"
"io/ioutil"
func BenchmarkEncoding(b *testing.B) {
segments := [][]byte{
[]byte{'a', 'b', 'c', 'd', '1', '2', '3', '4', '5'},
[]byte{'a', '/', 'a', '2', 'a', 'a', 0, '1', 'b', 255},
[]byte{'/', '/', 'a', 0, 'a', 'a', 0, '1', 'b', 'g', 'a', 'b', '/'},
[]byte{0, '/', 'a', '0', 'a', 'a', 0, '1', 'b', 'g', 'a', 'b', 0},
[]byte{'a', '/', 'a', '2', 'a', 'a', 0, '1', 'b', 255, 'a', '/', 'a', '2', 'a', '/', 0, '1', 'b', 255},
}
b.Run("ReplaceAll", func(b *testing.B) {
#!/bin/bash
# set go modules to default behavior
export GO111MODULE=auto
# go knows where our gopath is
export GOPATH=~/storj
# gospace knows where our gopath is (this is to avoid accidental damage to existing GOPATH)
# you should not use default GOPATH here
func BenchmarkValidation(b *testing.B) {
buckets := [][]byte{
[]byte("five5"),
[]byte("abcd-abcd-abcd-abcd-abcd-abcd"),
[]byte("abcd-abcd-abcd-abcd-abcd-abcd-abcd-abcd-abcd-abcd-abcd-abcd"),
}
for _, bucket := range buckets {
b.Run("simple-size-"+strconv.Itoa(len(bucket)), func(b *testing.B) {
for n := 0; n < b.N; n++ {
labels := bytes.Split(bucket, []byte("."))

Keybase proof

I hereby claim:

  • I am mniewrzal on github.

  • I am mniewrzal (https://keybase.io/mniewrzal) on keybase.

  • I have a public key ASCnHL9GI_wZRzT9hbulPZgD_TgoA3pek_vBKEJAZCZYYQo

!ENTRY org.eclipse.lsp4e 4 0 2017-06-19 11:47:18.218
!MESSAGE
!STACK 0
java.util.concurrent.TimeoutException
at java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1756)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
at org.eclipse.lsp4e.ProjectSpecificLanguageServerWrapper.getServerCapabilities(ProjectSpecificLanguageServerWrapper.java:410)
at org.eclipse.lsp4e.LanguageServiceAccessor.getMatchingStartedWrapper(LanguageServiceAccessor.java:324)
at org.eclipse.lsp4e.LanguageServiceAccessor.getLSWrapper(LanguageServiceAccessor.java:249)
at org.eclipse.lsp4e.LanguageServiceAccessor.getLSPDocumentInfoFor(LanguageServiceAccessor.java:193)
/*******************************************************************************
* Copyright (c) 2017 Alex Xu and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alex Xu - initial API and implementation
*******************************************************************************/