https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png

| const {Action, Event, Property, Thing, WebThingServer} = require('./index'); | |
| const uuidv4 = require('uuid/v4'); | |
| var Thingy = require('thingy52'); | |
| var Color = require('color'); | |
| console.log('Reading Thingy environment sensors!'); | |
| class ButtonEvent extends Event { | |
| constructor(thing, state) { |
| unsigned char* hexstr_to_char(const char* hexstr) | |
| { | |
| size_t len = strlen(hexstr); | |
| IF_ASSERT(len % 2 != 0) | |
| return NULL; | |
| size_t final_len = len / 2; | |
| unsigned char* chrs = (unsigned char*)malloc((final_len+1) * sizeof(*chrs)); | |
| for (size_t i=0, j=0; j<final_len; i+=2, j++) | |
| chrs[j] = (hexstr[i] % 32 + 9) % 25 * 16 + (hexstr[i+1] % 32 + 9) % 25; | |
| chrs[final_len] = '\0'; |
The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.
Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.
Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name
of target host:
[Unit]
Description=Setup a secure tunnel to %I
After=network.target| [Unit] | |
| Description=Keeps a tunnel to 'remote.example.com' open | |
| After=network.target | |
| [Service] | |
| User=autossh | |
| # -p [PORT] | |
| # -l [user] | |
| # -M 0 --> no monitoring | |
| # -N Just open the connection and do nothing (not interactive) |
| #!/bin/bash | |
| # | |
| # WLAN Minitoring Script Version v2.0 | |
| # OpenWrt Atheros wireless radio STA status monitor | |
| # Developed by dir2cas <[email protected]> | |
| # | |
| # Comments: | |
| # Required packages: bash, iw, kmod- packages&drivers to get your wireless interface running | |
| # Optional packages: | |
| # install with $ opkg update; opkg install iw bash .... |
| # V1 | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1001?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30 | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1002?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30 | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1003?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30 | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1004?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30 | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1005?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd"-d 30 | |
| #for Demo version | |
| curl -X PUT "http://api.netpie.io/topic/TraffyPatong/v/1/time/id/1007?retain&auth=tN5raLDu2VRFqS8%3Aej78ZOAB8bMqxyym1UbC8CtGd" -d 30 |
| #include <DHT.h> | |
| #include <ESP8266WiFi.h> | |
| // replace with your channel's thingspeak API key, | |
| String apiKey = "88Z86W9GHVXIDXDW"; | |
| const char* ssid = "xxxxx"; | |
| const char* password = "xxxxx"; | |
| const char* server = "api.thingspeak.com"; | |
| #define DHTPIN 12 // what pin we're connected to |
| #include <DHT.h> | |
| #include <ESP8266WiFi.h> | |
| // replace with your channel's thingspeak API key, | |
| String apiKey = "88Z86W9GHVXIDXDW"; | |
| const char* ssid = "xxxxx"; | |
| const char* password = "xxxxx"; | |
| const char* server = "api.thingspeak.com"; | |
| #define DHTPIN 12 // what pin we're connected to |