This file contains hidden or 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 tensorflow as tf | |
| from tensorflow.python.framework import ops | |
| from tensorflow.python.ops import gen_nn_ops | |
| @ops.RegisterGradient("GuidedRelu") | |
| def _GuidedReluGrad(op, grad): | |
| return tf.select(0. < grad, gen_nn_ops._relu_grad(grad, op.outputs[0]), tf.zeros(grad.get_shape())) | |
| if __name__ == '__main__': | |
| with tf.Session() as sess: |
This file contains hidden or 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 keras.models import Sequential | |
| from keras.layers.core import Dense, Dropout, Activation, Flatten | |
| from keras.layers.convolutional import Convolution2D, MaxPooling2D | |
| from keras.layers.normalization import BatchNormalization | |
| #AlexNet with batch normalization in Keras | |
| #input image is 224x224 | |
| model = Sequential() | |
| model.add(Convolution2D(64, 3, 11, 11, border_mode='full')) |
This file contains hidden or 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
| a = [5, 3, 2] | |
| b = a | |
| # should see [5,3,2] | |
| puts b.inspect | |
| a[0] = 7 | |
| # should see [7,3,2] | |
| puts b.inspect |
This file contains hidden or 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
| /* | |
| * cv_utils.cpp | |
| * | |
| * Created on: Dec 7, 2012 | |
| * Author: tan | |
| * Related blog post at: | |
| * http://sidekick.windforwings.com/2012/12/opencv-separating-items-on-store-shelves.html | |
| * | |
| */ |
This file contains hidden or 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
| class Card | |
| def initialize | |
| end | |
| def rank | |
| @rank | |
| end | |
| def rank=(r) | |
| # you can do other stuff in here |
This file contains hidden or 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
| class Card | |
| def initialize | |
| self.rank | |
| end | |
| def rank | |
| puts "hello" | |
| end | |
| end |
This file contains hidden or 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
| # | |
| # CORS header support | |
| # | |
| # One way to use this is by placing it into a file called "cors_support" | |
| # under your Nginx configuration directory and placing the following | |
| # statement inside your location block(s): | |
| # | |
| # include cors_support; | |
| # | |
| # A limitation to this method is that Nginx doesn't currently send headers |
This file contains hidden or 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" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| // Example SSE server in Golang. |
This file contains hidden or 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
| myhost = "localhost" | |
| @es = Elasticsearch::Client.new host: myhost, port: 9200, log: true | |
| @es.create index: "hello", | |
| type: "world", | |
| id: "someitem", | |
| body: { | |
| text: "yup", | |
| count: 1 |
This file contains hidden or 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
| results = @es.search(index: index_name, | |
| ignore_unavailable: true, | |
| body: { | |
| size: 0, | |
| query: { | |
| query_string: { | |
| query: search_phrase | |
| } | |
| } | |
| }) |
NewerOlder