Skip to content

Instantly share code, notes, and snippets.

@DeanThompson
DeanThompson / defer_test.go
Created December 18, 2014 07:19
A simple test case to measure the additional time taken by defer in golang
package test
import (
"sync"
"testing"
)
type SyncedStruct struct {
a int
mutex sync.RWMutex
@DeanThompson
DeanThompson / latlng_distance.go
Last active August 29, 2015 14:08
calculate distance in meters between two given location point
package main
import (
"math"
)
const (
RAD_FACTOR = math.Pi / 180.0
EARTH_RADIUS = 6371000
)
@DeanThompson
DeanThompson / ecb.go
Last active February 12, 2023 05:10
Golang AES ecb mode
package utils
import "crypto/cipher"
type ecb struct {
b cipher.Block
blockSize int
}
func newECB(b cipher.Block) *ecb {