Skip to content

Instantly share code, notes, and snippets.

View codemartial's full-sized avatar

Tahir Hashmi codemartial

View GitHub Profile
@codemartial
codemartial / standardise_iso.py
Created March 13, 2014 04:29
A filter to normalise ISO values to the nearest lower standard ISO
#!/usr/bin/python
import sys
limits = [0, 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200]
if __name__ == "__main__":
for line in sys.stdin:
iso = float(line)
print max([x for x in limits if x <= iso])
@codemartial
codemartial / no_polymorphism.go
Last active December 22, 2015 04:58
A demo of how embedding in Go does not result in polymorphic behaviour, unlike inheritance. More here: http://tech.t9i.in/2014/01/inheritance-semantics-in-go/
package main
import (
"fmt"
)
type Foo struct {
}
type Bar struct {