Skip to content

Instantly share code, notes, and snippets.

View vivekmittal's full-sized avatar

Vivek Mittal vivekmittal

View GitHub Profile
@vivekmittal
vivekmittal / encode_oh.gist
Last active February 9, 2019 08:09
Operational hour encoding
const OperationalHourStepSizeInMinutes = 5
func Encode(t time.Time) int64 {
return encode(int(t.Weekday()), t.Hour(), t.Minute())
}
func encode(weekday int, hour int, minute int) int64 {
wd := ((weekday*100 + hour) * 100) + (minute/OperationalHourStepSizeInMinutes)*OperationalHourStepSizeInMinutes
return int64(wd)
}

Keybase proof

I hereby claim:

  • I am vivekmittal on github.
  • I am vivekm (https://keybase.io/vivekm) on keybase.
  • I have a public key whose fingerprint is D3FB 9BA8 3A91 05E7 6D47 6C7A 7911 BADE 4036 A7EB

To claim this, I am signing this object:

@vivekmittal
vivekmittal / Problem 1
Last active August 29, 2015 14:12
Project Euler
-- Sum of multiples of 3 or 5 below 1000
sum [x | x<-[1..999], (x `mod` 3==0 || x `mod` 5==0)]