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
const { SinricPro, SinricProActions, raiseEvent, eventNames, SinricProUdp } = require('sinricpro'); // Use require('sinricpro'); if you are using NPM | |
const appKey = ''; // d89f1***-****-****-****-************ | |
const secretKey = ''; // f44d1d31-1c19-****-****-9bc96c34b5bb-d19f42dd-****-****-****-************ | |
const device1 = ''; // 5d7e7d96069e275ea9****** | |
const device2 = ''; // 5d80ac5713fa175e99****** | |
const deviceId = [device1] | |
function setPowerState(deviceid, data) { | |
console.log(deviceid, data); |
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
/* | |
* Copyright (c) 2019 Sinric. All rights reserved. | |
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA) | |
* | |
* This file is part of the Sinric Pro (https://github.com/sinricpro/) | |
*/ | |
#ifndef _SINRICAIRQUALITYSENSOR_H_ | |
#define _SINRICAIRQUALITYSENSOR_H_ |
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
Encrypt in Flutter | |
String encryptDecrypt(String input) { | |
var key = ['KCQ']; //Can be any chars, and any size array | |
var output = []; | |
for(var i = 0; i < input.length; i++) { | |
var charCode = input.codeUnitAt(i) ^ key[i % key.length].codeUnitAt(0); | |
output.add(new String.fromCharCode(charCode)); | |
} |
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
{ | |
"context": {}, | |
"event": { | |
"header": { | |
"messageId": "cedd4af3-a6ce-4e13-9c72-6bed87261eb6", | |
"namespace": "Alexa", | |
"name": "ChangeReport", | |
"payloadVersion": "3" | |
}, | |
"endpoint": { |
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
const int RELAY_PIN = 3; | |
void setup() { | |
pinMode(RELAY_PIN, OUTPUT); | |
} | |
void loop() { | |
digitalWrite(RELAY_PIN, HIGH); | |
delay(500); | |
digitalWrite(RELAY_PIN, LOW); |
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
//#define ENABLE_DEBUG | |
#ifdef ENABLE_DEBUG | |
#define DEBUG_ESP_PORT Serial | |
#define NODEBUG_WEBSOCKETS | |
#define NDEBUG | |
#endif | |
#include <Arduino.h> | |
#ifdef ESP8266 |
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 Wait { | |
public: | |
Wait() : next_millis(0) {} | |
bool operator()(unsigned long wait_millis, bool instant=false) { | |
unsigned long current_millis = millis(); | |
if (next_millis == 0 && instant==false) next_millis = current_millis + wait_millis; | |
if (current_millis >= next_millis) { | |
next_millis = current_millis + wait_millis; | |
return true; | |
} |
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
[user@localhost certs]$ oc get builds | |
NAME TYPE FROM STATUS STARTED DURATION | |
nodejs-mongo-persistent-1 Source Git@e59fe75 Complete About an hour ago 2m37s | |
simple-nginx-ssl-reverseproxy-1 Source Git@552932f Complete 16 minutes ago 47s |
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
String encrypt(String plain_data){ | |
int i; | |
// PKCS#7 Padding (Encryption), Block Size : 16 | |
int len = plain_data.length(); | |
int n_blocks = len / 16 + 1; | |
uint8_t n_padding = n_blocks * 16 - len; | |
uint8_t data[n_blocks*16]; | |
memcpy(data, plain_data.c_str(), len); | |
for(i = len; i < n_blocks * 16; i++){ | |
data[i] = n_padding; |
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
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
char buf[50]; | |
int64_t upTimeUS = esp_timer_get_time(); // in microseconds | |
int64_t seconds = upTimeUS/1000000; | |
uint32_t days = (uint32_t)seconds/86400; | |
uint32_t hr=(uint32_t)seconds % 86400 / 3600; |