Skip to content

Instantly share code, notes, and snippets.

package core
import (
"context"
"encoding/json"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/google/uuid"
@Ja7ad
Ja7ad / message.go
Created October 10, 2023 08:53
decorated jetstream.Msg for NakWithDynamicDelay
package nats
import (
"github.com/hashicorp/golang-lru/v2/expirable"
"github.com/nats-io/nats.go/jetstream"
"time"
)
type Msg interface {
jetstream.Msg
@Ja7ad
Ja7ad / main.go
Last active October 10, 2023 08:54
nats nak with dynamic delay (step by step)
package main
import (
"context"
"encoding/json"
"errors"
"github.com/brianvoe/gofakeit/v6"
"github.com/hashicorp/golang-lru/v2/expirable"
"github.com/lithammer/shortuuid/v3"
"github.com/nats-io/nats.go"
@Ja7ad
Ja7ad / lottery.go
Last active August 6, 2023 05:21
Lottery Game and Add to number
package main
import (
"encoding/json"
"fmt"
"log"
"math/rand"
"net/http"
"time"
)
@Ja7ad
Ja7ad / main.go
Created May 2, 2023 07:18
elastic example query
package main
import (
"context"
"fmt"
"github.com/elastic/go-elasticsearch/v7"
"log"
"strings"
)
@Ja7ad
Ja7ad / clear_test.go
Last active April 30, 2023 05:50
benchmark clear feature in go1.21
package main
import (
"testing"
"time"
)
func BenchmarkClearMapWithDelete(b *testing.B) {
b.ReportAllocs()
test := createMap(100000)
openapi: 3.0.1
info:
title: test.proto
version: version not set
servers:
- url: /
tags:
- name: Foo
paths:
/list:

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@Ja7ad
Ja7ad / README.md
Last active September 7, 2022 03:59
mongodb with builder pattern

MongoDB Constructor with Builder Pattern

You can create new object of mongodb client and database

Example

package main

import "log"
@Ja7ad
Ja7ad / main.go
Last active August 2, 2022 06:09
nats embbeded server
package main
import (
"fmt"
"time"
"github.com/nats-io/nats-server/v2/server"
"github.com/nats-io/nats.go"
)