Skip to content

Instantly share code, notes, and snippets.

Avatar

Olivier Wulveryck owulveryck

View GitHub Profile
@owulveryck
owulveryck / app.js
Last active Jan 19, 2022
WebSocket simple example / server in go, client in JS
View app.js
window.addEventListener("load", function(evt) {
var output = document.getElementById("output");
var input = document.getElementById("input");
var ws;
var print = function(message) {
var d = document.createElement("div");
d.innerHTML = message;
output.appendChild(d);
@owulveryck
owulveryck / AAA README.md
Last active Jan 3, 2022
app.yaml environment variables substitution
View AAA README.md

This is a code snippet that reads an "app.yaml" file on stdin; then it:

  • seek for env_variables entry in the file
  • for each key: value pair, it looks for an environment variables named value
  • if it exists, it substitute the value with value found in the environment.

Exemple:

cat app.yaml

@owulveryck
owulveryck / AAA README.md
Last active Nov 27, 2021
Generateur de QR Code tous anti covid
View AAA README.md

go run . > output.png

@owulveryck
owulveryck / README.md
Last active Aug 1, 2021
Simple linear regression with plot in go with gonum
View README.md

Very simple linear regression

curl -s //www.lauradhamilton.com/data_files/cricket_chirps_versus_temperature.txt | go run main.go > output.svg
2018/06/13 19:57:59 3.3057614388773593*x+24.966014428303183
@owulveryck
owulveryck / iris.csv
Last active Jul 14, 2021
Linear regression on iris dataset with Gorgonia and gota
View iris.csv
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 / main.go
Last active Jul 2, 2021
Simple script to turn a webpage into an epub
View main.go
package main
import (
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
@owulveryck
owulveryck / AAA sample.md
Last active Jun 15, 2021
Trivial server that validates data and send it to kafka
View AAA sample.md

Running the sample:

go run . definition.cue

Getting the OpenAPI

❯ curl http://localhost:8181/openapi returns:

{
@owulveryck
owulveryck / sample_test.go
Created Jun 15, 2021
CUE -> OpenAPI generation
View sample_test.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"cuelang.org/go/cue"
"cuelang.org/go/cue/load"
@owulveryck
owulveryck / sample_test.go
Created Jun 14, 2021
Simple cloudevents creation from a cue value
View sample_test.go
package main
import (
"encoding/json"
"log"
"reflect"
"testing"
"time"
"cuelang.org/go/cue"
@owulveryck
owulveryck / sample.go
Last active Jun 14, 2021
Simple webservice to validate data with CUE
View sample.go
package sample
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"