Skip to content

Instantly share code, notes, and snippets.

@andreareginato
andreareginato / sftp-node-server.js
Created October 6, 2017 15:48
sftp node server
"use strict";
var fs = require('fs');
var SFTPServer = require("node-sftp-server");
var ReadableStreamClone = require("readable-stream-clone");
// create the server
var srv = new SFTPServer({
privateKeyFile: "./id_rsa",
temporaryFileDirectory: "./tmp"
});
{
"id": "5735a694dcba0f0892824613",
"batch_id": "MARCASAR002",
"customer_id": "5731fdd2b3f30a687138ceea",
"uri": "http://admin.idcork.com/batches/5735a694dcba0f0892824613",
"code": null,
"description": null,
"article": null,
"quality": null,
"diameter": null,
{
"id": "5735a694dcba0f0892824613",
"batch_id": "MARCASAR002",
"customer_id": "5731fdd2b3f30a687138ceea",
"uri": "http://admin.idcork.com/batches/5735a694dcba0f0892824613",
"code": null,
"description": null,
"article": null,
"quality": null,
"diameter": null,
a:1:{i:0;a:8:{i:0;a:21:{s:2:"id";s:1:"1";s:10:"customerId";s:1:"1";s:10:"operatorId";s:1:"1";s:15:"rack_group_name";s:5:"Staz1";s:17:"gruop_station_uid";s:12:"notAssigned2";s:19:"rack_group_location";s:14:"Staz. -12-05 -10-28 -08-26 -08-26 -11-19 -11-20 -12-06 -11-19
@andreareginato
andreareginato / ez-final.ino
Last active August 29, 2015 14:25
ez-final.ino
// Generic libraries
#include <Adafruit_CC3000.h>
#include <ccspi.h>
#include <SPI.h>
#include <cc3000_PubSubClient.h>
// Interrupt and control pins
#define ADAFRUIT_CC3000_IRQ 2
#define ADAFRUIT_CC3000_VBAT 8
#define ADAFRUIT_CC3000_CS 10
import paho.mqtt.client as paho
import RPi.GPIO as GPIO
import json, time
# device credentials
device_id = '<DEVICE_ID>' # * set your device id (will be the MQTT client username)
device_secret = '<DEVICE_SECRET>' # * set your device secret (will be the MQTT client password)
random_client_id = '<CLIENT_ID>' # * set a random client_id (max 23 char)
# -------------- #
var mraa = require('mraa');
console.log("\n");
console.log("╦┌┐┌┌┬┐┌─┐┬ ┬ ┬ ┬ ┬┌─┬┌┬┐┌─┐┬ ┬┌─┐┌┐┌");
console.log("║│││ │ ├┤ │ │ └┬┘ ├┴┐│ │ │ ├─┤├┤ │││");
console.log("╩┘└┘ ┴ └─┘┴─┘┴─┘┴ ┴ ┴┴ ┴ └─┘┴ ┴└─┘┘└┘");
console.log("\nWelcome to the Intelly Kitchen tutorial based on Intel Edison and Lelylan \n");
console.log("(This is a proof of concept and could not properly work as expected. Any help appreciated dev@lelylan.com) \n");
exports.mqtt = {
type: 'process',
specific: {
repositoryUrl: 'git@github.com:lelylan/mqtt.git',
execute: {
args: '-e "DEBUG=lelylan" -e "REDIS_HOST=178.62.31.9" -p 1883:1883 -d'
}
}
};
exports.name = 'lelylan_mqtt';
exports.namespace = 'lelylan_mqtt';
exports.id = '6b4b4e3f-f22e-4516-bffb-e1a8daafb3ea';
exports.topology = {
local: {
},
direct: {
machine$1: {
# Listen to all MQTT requests
listen mqtt
# MQTT binding to port 1883
bind *:1883
# MQTT binding to port 8883
bind *:8883 ssl crt /certs/lelylan.pem
...