Skip to content

Instantly share code, notes, and snippets.

var mqtt = require('mqtt');
var client1 = mqtt.connect('mqtt://172.20.0.2');
var client2 = mqtt.connect('mqtt://172.20.0.3');
client1.on('connect', function () {
client1.subscribe("foo")
});
client1.on('message', function (topic, message) {
console.log("got msg", topic, message.toString());
@muka
muka / http-server.sh
Created August 7, 2018 20:00
netcat http server
while [ 1 ]; do
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <index.html)\r\n\r\n"; cat index.html; } | nc -l 8080
done
@muka
muka / setup.sh
Created July 8, 2018 04:20
gocv / openvino setup
. /data/opt/intel/computer_vision_sdk_2018.2.300/bin/setupvars.sh
. openvino/env.sh
CGO_LDFLAGS="$CGO_LDFLAGS -lopencv_calib3d"
LD_LIBRARY_PATH=/home/l/git/github.com/openvino-docker/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
LD_LIBRARY_PATH=/data/opt/intel/computer_vision_sdk_2018.2.300/deployment_tools/inference_engine/lib/ubuntu_16.04/intel64:$LD_LIBRARY_PATH
export CGO_LDFLAGS
export LD_LIBRARY_PATH
@muka
muka / ubuntu-termk.md
Created July 7, 2018 10:43
atom terminal with termrk

apm install termrk

To use ctrl+` to toggle

keymap.cson

'atom-workspace':
  'ctrl-\`': 'termrk:toggle'   
@muka
muka / tf_obj_tutorial.md
Created March 13, 2018 10:45 — forked from douglasrizzo/tf_obj_tutorial.md
TensorFlow Object Detection Model Training
@muka
muka / install-protoc.sh
Last active March 20, 2018 14:04
How to install protoc to use with grpc
#Get a release here https://github.com/google/protobuf/releases
sudo -s
cd /usr/local/include
mkdir google
wget https://github.com/google/protobuf/releases/download/v3.5.0/protoc-3.5.0-linux-x86_64.zip -O protoc.zip
unzip protoc.zip -d tmp
@muka
muka / example.md
Last active November 19, 2017 05:35

Notice: as per node-red contrib guideline, the module has been renamed node-red-contrib-openfaas

Setup

  • Start OpenFaaS
  • Install node-red-admin sudo npm i -g node-red-admin
  • Start node-red docker run -it --rm -p 1880:1880 -v `pwd`:/shared --network host --name mynodered nodered/node-red-docker
  • Install openfaas module node-red-admin install node-red-contrib-openfaas
  • Done go to http://127.0.0.1:1880