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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"strings" | |
) |
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
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) |
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 ubuntu:16.04 | |
# install java 8 and other tools | |
RUN apt-get update && apt-get install -y --no-install-recommends default-jdk curl git && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
# needed to install cassandra | |
apt-get install -y --no-install-recommends curl && \ | |
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" >> /etc/apt/sources.list.d/cassandra.sources.list && \ | |
curl https://www.apache.org/dist/cassandra/KEYS | apt-key add - && \ | |
apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA && \ |