This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function checkAssembly(row, emit) { | |
emit({ b: WebAssembly != undefined }); | |
} | |
bigquery.defineFunction( | |
'checkAssembly', | |
['x'], | |
[{ 'name': 'b', 'type': 'boolean' }], | |
checkAssembly | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const memory = new WebAssembly.Memory({ initial: 256, maximum: 256 }); | |
const env = { | |
'abortStackOverflow': _ => { throw new Error('overflow'); }, | |
'table': new WebAssembly.Table({ initial: 0, maximum: 0, element: 'anyfunc' }), | |
'tableBase': 0, | |
'memory': memory, | |
'memoryBase': 1024, | |
'STACKTOP': 0, | |
'STACK_MAX': memory.buffer.byteLength, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <dlfcn.h> | |
int main() | |
{ | |
int (*sum)(int, int); | |
void *dl = dlopen("sum.so", RTLD_LAZY); | |
if (!dl) | |
{ | |
fprintf(stderr, "%s\n", dlerror()); | |
return 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
extern int sum(int a, int b); | |
int main() { | |
printf("%d\n", sum(39, 3)); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sum(int a, int b) | |
{ | |
return a + b; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function intdiv(row, emit) { | |
emit({ d: row.x / row.y, m: row.x % row.y }); | |
} | |
bigquery.defineFunction( | |
'intdiv', | |
['x', 'y'], | |
[{ 'name': 'd', 'type': 'integer' }, | |
{ 'name': 'm', 'type': 'integer' }], | |
intdiv | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function identity(row, emit) { | |
emit({ y: row.x }); | |
} | |
bigquery.defineFunction( | |
'identity', | |
['x'], | |
[{ 'name': 'y', 'type': 'float' }], | |
identity | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie-backports as build | |
RUN apt-get update && apt-get install -y \ | |
asciidoc asciidoctor source-highlight graphviz \ | |
gcc libssl-dev uuid-dev libncurses-dev libcurl4-openssl-dev flex clang-3.5 bison \ | |
parallel | |
RUN apt-get install -y -t jessie-backports openjdk-8-jdk | |
# install golang | |
RUN apt-get install -y curl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url('https://fonts.googleapis.com/css?family=Montserrat'); | |
@import url('https://fonts.googleapis.com/css?family=Inconsolata'); | |
@media screen { | |
/* Framework */ | |
html { | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modelBytes, _ := assets.Asset("model.pb") | |
graph := tf.NewGraph() | |
graph.Import(modelBytes, "") | |
input := graph.Operation("input").Output(0) | |
output := graph.Operation("output").Output(0) | |
sess, _ := tf.NewSession(graph, &tf.SessionOptions{}) | |
feed, _ := tf.NewTensor([][]float32{}) | |
result, _ := sess.Run( | |
map[tf.Output]*tf.Tensor{input: input1}, | |
[]tf.Output{output}, nil) |