Skip to content

Instantly share code, notes, and snippets.

View nitishfy's full-sized avatar
🎯
Focusing

Nitish Kumar nitishfy

🎯
Focusing
View GitHub Profile
@nitishfy
nitishfy / main_test.go
Last active January 2, 2025 14:34
Benchmarking
package main
import (
"fmt"
"strings"
"testing"
)
// generateArgs generates args (100)
func generateArgs() []string {
@nitishfy
nitishfy / mp_mc.go
Last active July 17, 2024 05:04
Producer-Consumer Problem
// multiple producers, multiple consumers
package main
import (
"fmt"
"sync"
)
// producers sends the value to the channel
func producers(id int, ch chan<- int, wg *sync.WaitGroup) {
@nitishfy
nitishfy / main.go
Last active June 7, 2024 11:09
Time To Live (TTL) Cache
package main
import (
"fmt"
"sync"
"time"
)
type Cache[K comparable, V any] struct {
data map[K]item[V]