Skip to content

Instantly share code, notes, and snippets.

$ rustc --target mips-unknown-linux-uclibc hello.rs
error[E0514]: found crate `std` compiled by an incompatible version of rustc
|
= help: please recompile that crate using this compiler (rustc 1.16.0-nightly (4ecc85beb 2016-12-28))
= note: crate `std` path #1: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd_unicode-ce2437639102870c.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #2: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd_shim-ce5875b2d5be2087.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #3: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/mips-unknown-linux-uclibc/lib/libstd-5e6fea6a0efe07f7.rlib compiled by "rustc 1.16.0-dev (4ecc85beb 2016-12-28)"
= note: crate `std` path #4: /home/vagrant/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustli
/*
* Copyright (c) 2016 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
/*
* Copyright (c) 2016 Couchbase, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
val spark = SparkSession
.builder
.master("local[*]")
.appName("StructuredWordCount")
.getOrCreate()
import spark.implicits._
val lines = spark.readStream
.format("socket")
val schema = StructType(
StructField("META_ID", StringType) ::
StructField("type", StringType) ::
StructField("name", StringType) :: Nil
)
// The SparkSession is the main entry point into spark
val spark = SparkSession
.builder()
.appName("N1QLExample")
StructType(
StructField("META_ID", StringType) ::
StructField("value", BinaryType) :: Nil
)
// Create the Spark Config and instruct to use the travel-sample bucket
// with no password.
val conf = new SparkConf()
.setMaster("local[*]")
.setAppName("StreamingExample")
.set("com.couchbase.bucket.travel-sample", "")
// Initialize StreamingContext with a Batch interval of 5 seconds
val ssc = new StreamingContext(conf, Seconds(5))
@daschl
daschl / arithmetic.py
Created October 17, 2016 12:08
input param not working?
import tensorflow as tf
a = tf.placeholder(tf.int32, name = 'a')
b = tf.placeholder(tf.int32, name = 'b')
add = tf.add(a, b, name = 'add')
tf.initialize_variables(tf.all_variables(), name = 'init')
definition = tf.Session().graph_def
tf.train.write_graph(definition, 'models', 'arithmetic.pb', as_text=False)
@daschl
daschl / cheatsheet.sql
Last active October 11, 2016 08:31
Eclipse MAT Couchbase SDK 2.x OQL Cheat Sheet
-- Finds all "Nodes", prints their hostname and their connection state
SELECT n.currentState.name.toString() AS state, n.hostname.holder.hostName.toString() AS hostname
FROM com.couchbase.client.core.node.CouchbaseNode n
-- Find all KV Endpoints, prints their hostname and their connection state and the bucket name
SELECT e.currentState.name.toString() AS state,
e.channel.requestedRemoteAddress.holder.addr.holder.hostName.toString() AS hostname,
e.bucket.toString() AS bucket
FROM com.couchbase.client.core.endpoint.kv.KeyValueEndpoint e
// Create observable for master and all the replicas
// The code maps it to a tuple where the boolean represents "found!"
// so if its not found the tuple will be <False, null> and if its found <True, JsonDocument>
Observable<Tuple2<Boolean, JsonDocument>> primary = bucket.async()
.get("doc")
.map(doc -> Tuple.create(true, doc))
.defaultIfEmpty(Tuple.create(false, null));
Observable<Tuple2<Boolean, JsonDocument>> first = bucket.async()