Skip to content

Instantly share code, notes, and snippets.

View shantanoo-desai's full-sized avatar

Shan Desai shantanoo-desai

View GitHub Profile
@shantanoo-desai
shantanoo-desai / sim_client_opcua.py
Last active June 15, 2021 19:53
basic OPC-UA Server/Client with Python3
import time
from opcua import Client
from opcua import ua
try:
from IPython import embed
except ImportError:
import code
def embed():
@shantanoo-desai
shantanoo-desai / productinfo.proto
Last active February 27, 2023 09:41
gRPC using Tonic in Rust (example from gRPC: Up and Running Book)
syntax = "proto3";
package ecommerce;
service ProductInfo {
rpc addProduct(Product) returns (ProductID);
rpc getProduct(ProductID) returns (Product);
}
message Product {
string id = 1;
@shantanoo-desai
shantanoo-desai / README.md
Last active February 20, 2023 20:13
tiguitto (Telegraf, InfluxDBv1.x, Grafana, Mosquitto) stack with Traefik v2.3 reverse proxy using docker

tiguitto Stack with Traefik v2.3 as reverse-proxy

  • Tested on Raspberry-Pi 4 Model B 2GB RAM
  • Docker Version: 19.03.8
  • Docker-Compose version: 1.25.5

Directory structure:

 .
@shantanoo-desai
shantanoo-desai / telegraf.convert.toml
Created September 3, 2020 13:49
Telegraf Configuration to connect to an MQTT Broker and converting Field to a Tag for InfluxDB
[agent]
interval = "2s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 12000000
@shantanoo-desai
shantanoo-desai / LineProtocolPayload.txt
Last active July 29, 2020 19:44
telegraf configuration file that connects to Mosquitto Open broker and pushes data into InfluxDB v1.x
# IOT/sensor2/temp
env,type=A temp=23.39
env,type=B temp=40.00
# IOT/sensor1/acc
env,type=A x=0.2
env,type=B x=1.3
@shantanoo-desai
shantanoo-desai / ESP32_9DOF_MQTT_Secure.ino
Last active June 29, 2020 13:21
Arduino Sketch for Sending Secure Data (TLSv1.2 Certificate) and Username/Password over MQTT Broker with ESP32 and LSM9DS0
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_LSM9DS0.h>
#include <Adafruit_Sensor.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
// CERTIFICATE Header File
@shantanoo-desai
shantanoo-desai / .travis.yml
Created April 25, 2020 17:13
travis.yml file for nestjs-products-api GitHub Repository
language: node_js
services:
- 'docker'
node_js:
- "10"
- "12"
cache:
@shantanoo-desai
shantanoo-desai / ESP32_9DOF_MQTT.ino
Created March 24, 2020 09:47
Arduino Sketch for programming an ESP32 with Adafruit's LSM9DS0 Sensor to publish data via MQTT
/* Arduino Sketch to Program an ESP32 to read LSM9DS0 Sensor from
* its I2C Bus, convert the data into InfluxDB's Line Protocol Strings
* and Publish it to an MQTT broker running on an IoT Edge Device (Pi4)
* Author: Shan Desai <https://github.com/shantanoo-desai>
*/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_LSM9DS0.h>
#include <Adafruit_Sensor.h>
@shantanoo-desai
shantanoo-desai / change_stream_example.py
Last active October 22, 2019 16:00
Change Stream for MongoDB using Windows 10, Docker, MongoDB and pymongo snippet
# Change Stream Example
# using PYMONGO v3.9.0
import sys
import pprint
from pymongo import MongoClient
# Create a Client to our Replica Set
cl = MongoClient(host='localhost', port=37017, replicaSet='rs0')
# Database: `team` # Collection: `players`
@shantanoo-desai
shantanoo-desai / test.json
Last active August 13, 2019 08:49
GitHub Gist test to use it as a static endpoint for JSON
{
"test": "This JSON will keep changing",
"version" : 0.3,
"url": "https://stackoverflow.com/questions/12522539/github-gist-editing-without-changing-url",
"features": [
"Feature1",
"Feature2",
"Feature3"
]
}