Skip to content

Instantly share code, notes, and snippets.

View gokhanm's full-sized avatar
🤗

Gokhan MANKARA gokhanm

🤗
View GitHub Profile
@gokhanm
gokhanm / main.go
Created December 26, 2023 08:50
High resolution timing and benchmarking for go channel
// https://github.com/egonelbre/exp/blob/main/bench/chan/main.go
package main
import (
"fmt"
"sync"
"github.com/loov/hrtime"
)
@gokhanm
gokhanm / main.go
Created December 26, 2023 08:48
timing and benchmarking for goroutine
// https://github.com/egonelbre/exp/blob/main/bench/goroutine/main.go
package main
import (
"fmt"
"runtime"
"sync"
"github.com/loov/hrtime"
)
@gokhanm
gokhanm / main.go
Last active June 28, 2022 09:27
Reverse Linked List in Go
package main
import (
"fmt"
)
type Node struct {
data interface{}
prev *Node
}
@gokhanm
gokhanm / singleton.go
Last active November 17, 2021 12:21
singleton pattern in go
package singleton
import (
"sync"
)
type singleton struct {
}
var instance *singleton
@gokhanm
gokhanm / verify.go
Created September 30, 2020 10:53
Generate RSA and Verify
func TestVerifyRsaSign(t *testing.T) {
c := New()
content := "messagetobesigned"
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
t.Error(err)
}
signature, err := sig(content, privateKey)
@gokhanm
gokhanm / gist:288b68c3e5befa3df430ae1607685f6d
Created August 27, 2020 14:13
Interval timer to run one function
// time.AfterFunc
package main
import (
"fmt"
"sync"
"time"
)
var wg sync.WaitGroup
@gokhanm
gokhanm / .gitconfig
Created December 18, 2019 11:41 — forked from Kovrinic/.gitconfig
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "git@github.com:"]
insteadOf = git://github
package main
import (
"fmt"
)
func chunkArray(array []string, limit int) [][]string {
var chunk []string
var chunks [][]string
@gokhanm
gokhanm / tmux-cheat-sheet.md
Created January 7, 2019 12:26 — forked from michaellihs/tmux-cheat-sheet.md
tmux Cheat Sheet
@gokhanm
gokhanm / remove_duplicates.go
Last active November 27, 2018 07:41
Golang Remove duplicate values from Slice
package main
import (
"fmt"
)
func unique(intSlice []int) []int {
keys := make(map[int]bool)
list := []int{}