Skip to content

Instantly share code, notes, and snippets.

View owulveryck's full-sized avatar

Olivier Wulveryck owulveryck

View GitHub Profile
@owulveryck
owulveryck / broadcast.go
Created July 22, 2020 06:08
Concurrence
func broadcast(ctx context.Context, ch <-chan gorgonia.Value, cs []chan gorgonia.Value) {
for {
select {
case msg := <-ch:
for _, c := range cs {
select {
case c <- msg:
case <-ctx.Done():
return
}
@owulveryck
owulveryck / app.yaml
Created February 5, 2020 10:36
Service static files with GAE (google app-engine)
runtime: python37
service: website
handlers:
- url: /(.*)/
static_files: www/\1/index.html
upload: www/(.*)
- url: /
static_files: www/index.html
@owulveryck
owulveryck / iris.csv
Last active August 8, 2022 02:30
Linear regression on iris dataset with Gorgonia and gota
sepal_length sepal_width petal_length petal_width species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
@owulveryck
owulveryck / kafka_test.go
Created October 17, 2019 15:09
kafka connect from Go with certificates
package main
import (
"context"
"crypto/tls"
"crypto/x509"
"io/ioutil"
"log"
"os"
"testing"
@owulveryck
owulveryck / compare_tensor.go
Last active August 17, 2019 09:34
yolo testing material
func eqInDelta(a,b tensor.Tensor, delta float32) bool {
outputValue := outputT[0].Data().([]float32)
expectedValue := expectedOutput.Data().([]float32)
if ! outputT[0].Shape().Eq(expectedOutput.Shape()) {
return false
}
for i := 0; i < len(outputValue); i++ {
if math.Abs(float64(outputValue[i]-expectedValue[i])) > delta {
return false
@owulveryck
owulveryck / keybase.md
Created May 16, 2019 08:20
keybase verification

Keybase proof

I hereby claim:

  • I am owulveryck on github.
  • I am owulveryck (https://keybase.io/owulveryck) on keybase.
  • I have a public key whose fingerprint is CA7D BBE2 A8D3 41AD 5419 D40F 2503 3D41 B2EA 07D5

To claim this, I am signing this object:

@owulveryck
owulveryck / main.go
Last active April 16, 2019 14:29
terraform tfvars diff: do a diff against two tfvars and returns an error if they do not contain the same variables.
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"os"
"github.com/hashicorp/hcl"
@owulveryck
owulveryck / main.go
Created April 11, 2019 12:40
Simple snake_case to camel case converter (https://play.golang.org/p/RtAzmSgnnvM)
package main
import (
"fmt"
"regexp"
"strings"
)
func main() {
fmt.Println(toCamelCase("blo_bla_Di_bla"))
@owulveryck
owulveryck / main.go
Created January 2, 2019 15:37
read file from string
func main() {
b, err := ioutil.ReadFile("model.onnx")
if err != nil {
panic(err)
}
/*
var qb bytes.Buffer
fmt.Fprint(&qb, `data := "`)
print(&qb, b)
fmt.Fprint(&qb, `"`)
@owulveryck
owulveryck / AAAReadme.md
Last active November 16, 2018 00:13
Markdown on the fly

Usage

go run *go github.com/owulveryck/test/