Skip to content

Instantly share code, notes, and snippets.

View MrAkaki's full-sized avatar

Alex Vargas Benamburg MrAkaki

View GitHub Profile
@MrAkaki
MrAkaki / rgb2Tone.h
Last active January 31, 2018 20:20
rgb to color tone
uint8_t rgb2H(uint8_t red, uint8_t green, uint8_t blue){
float r = red/255. , g=green/255. , b=blue/255.;
float cMax = max(max(r, g), b);
float cMin = min(min(r, g), b);
float delta = cMax - cMin;
float h = 0;
if(delta > 0) {
if(cMax == r) {
h = 60 * (fmod(((g - b) / delta), 6));
@MrAkaki
MrAkaki / apache-thingsboard.conf
Last active January 24, 2022 09:56
Apache proxy ssl thingsboard
<VirtualHost *:443>
ServerAdmin "EMAIL ADMIN"
DocumentRoot /var/www/html
ServerName "SERVERNAME"
ProxyRequests off
ProxyPreserveHost On
#Redireccion de wss a ws
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
@MrAkaki
MrAkaki / server-report.js
Created January 22, 2018 06:09
ThingsBoard Server Monitor
// Requires node.js and mqtt library installed.
var mqtt = require('mqtt');
var os = require("os");
const thingsboardHost = "SERVERNAME";
// Reads the access token from arguments
const accessToken = 'ACCESS_TOKEN';
// Default topics. See http://thingsboard.io/docs/reference/mqtt-api/ for more details.
const attributesTopic = 'v1/devices/me/attributes';