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
| <html> | |
| <head> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css"> | |
| <script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
| <script src="https://unpkg.com/preact"></script> | |
| </head> | |
| <body> </body> | |
| <script> | |
| var h = preact.h; | |
| var App = function(props) { |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>mDash Smart Light</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.5/css/bulma.min.css"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> | |
| <script src="https://unpkg.com/axios/dist/axios.min.js"></script> |
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 Sergey Lyubka | |
| // All rights reserved | |
| #include <stdio.h> | |
| #include <string.h> | |
| enum { TOK_EOF = '#', TOK_NUM = 'N', TOK_IDENT = 'I' }; | |
| enum { ERR_OK, ERR_EXPECTED_NUM, ERR_EXPECTED_PAREN }; | |
| //#define DEBUG(fmt, ...) printf("%s:" fmt "\n", __func__, __VA_ARGS__) | |
| #define DEBUG(fmt, ...) |
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) Cesanta Software Limited | |
| // All rights reserved | |
| #include "main.h" | |
| #define REPORT_FREQUENCY_MS 5000 | |
| // This function is called by the main superloop every 10ms. | |
| // We trigger shadow update each REPORT_FREQUENCY_MS milliseconds. | |
| // The other way to do it is to start a dedicated FreeRTOS task. |
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
| #include <stdio.h> | |
| struct entry { | |
| int value; | |
| struct entry *next; | |
| }; | |
| static void out(struct entry *e) { | |
| if (e->next != NULL) out(e->next); | |
| printf("%d\n", e->value); |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>hiii</title> | |
| <meta charset="utf-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <link rel="stylesheet" href="https://unpkg.com/bootstrap@4.3.1/dist/css/bootstrap.min.css" /> | |
| <script src="https://unpkg.com/preact@8.4.2"></script> | |
| <script src="https://unpkg.com/htm@2.2.1"></script> |
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
| char *read_file(const char *path) { | |
| FILE *fp; | |
| char *data = NULL; | |
| if ((fp = fopen(path, "rb")) == NULL) { | |
| } else if (fseek(fp, 0, SEEK_END) != 0) { | |
| fclose(fp); | |
| } else { | |
| size_t size = ftell(fp); | |
| data = (char *) malloc(size + 1); | |
| if (data != NULL) { |
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 WebSocket = require('ws'); // npm install -g ws | |
| const server = new WebSocket.Server({port: 8000}, function() { | |
| console.log('WS server started'); | |
| }); | |
| server.on('connection', function connection(ws, req) { | |
| let i = 0; | |
| ws.on('message', function incoming(message) { | |
| console.log('received', message); | |
| }); | |
| console.log('connected', req.connection.remoteAddress); |
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
| static int BAUD = 115200, RTS = -1, DTR = -1, ESP32_GPIO = 11, ESP32_RESETN = 12; | |
| void setup() { | |
| Serial.begin(baud); | |
| Serial1.begin(baud); | |
| pinMode(ESP32_GPIO0, OUTPUT); | |
| pinMode(ESP32_RESETN, OUTPUT); | |
| // Reset ESP32, put into upload mode | |
| digitalWrite(ESP32_GPIO0, 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
| void setup() { | |
| Serial.begin(115200); | |
| pinMode(LED_BUILTIN, OUTPUT); | |
| } | |
| void loop() { | |
| if (Serial.available() > 0) { | |
| int character = Serial.read(); | |
| if (character == '0') digitalWrite(LED_BUILTIN, LOW); // '0' switches LED off | |
| if (character == '1') digitalWrite(LED_BUILTIN, HIGH); // '1' switches LED on |