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
| function doPost(e) { | |
| try { | |
| var obj = JSON.parse(e.postData.contents); | |
| var doc = SpreadsheetApp.getActiveSpreadsheet(); | |
| var name = obj.id || 'DATA'; | |
| var sheet = doc.getSheetByName(name); | |
| if (!sheet) { | |
| doc.insertSheet(name); | |
| sheet = doc.getSheetByName(name); | |
| range = sheet.getRange("H1:Z1"); |
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> | |
| <title>Preact without Babel or JSX</title> | |
| </head> | |
| <body> | |
| <script src="https://unpkg.com/preact"></script> | |
| <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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Preact with JS3</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css"> | |
| <script src="https://unpkg.com/history/umd/history.min.js"></script> | |
| <script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
| <script src="https://unpkg.com/preact"></script> | |
| <script src="https://unpkg.com/preact-router"></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
| <!DOCTYPE html> | |
| <html class="h-100"> | |
| <head> | |
| <title>Preact with JS3</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css"> | |
| <script src="https://unpkg.com/axios/dist/axios.min.js"></script> | |
| <script src="https://unpkg.com/preact"></script> | |
| </head> |
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
| import base64 | |
| import json | |
| import firebase_admin | |
| from firebase_admin import db | |
| firebase_admin.initialize_app( | |
| credential=None, | |
| options={'databaseURL' : 'https://YOUR_FIREBASE_DB_NAME.firebaseio.com'}, | |
| ) |
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 "mgos.h" | |
| #include "mgos_rpc.h" | |
| #include "mgos_shadow.h" | |
| static void report_state_to_the_shadow(void) { | |
| const struct mgos_conf_entry *schema = | |
| mgos_conf_find_schema_entry("KEY", mgos_config_schema()); | |
| struct mbuf mb; | |
| mbuf_init(&mb, 0); | |
| mgos_conf_emit_cb(&mgos_sys_config, NULL, schema, false, &mb, NULL, 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
| var http = require('http'); | |
| var port = 8080; | |
| var server = http.createServer(function(request, response) { | |
| console.log('Requested URI:', request.url); | |
| response.writeHead(200, {'Content-Type': 'application/json'}); | |
| response.write(JSON.stringify({a: 1, b: 2}), 'utf-8'); | |
| response.end(); | |
| }); | |
| server.listen(parseInt(port, 10)); |
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
| #!/bin/sh | |
| # Usage: | |
| # sh bt.sh sketch_Apr25 400d4e36:0x3ffb1e50 0x400d1bce:0x3ffb1e90 0x400d1d96:0x3ffb1ee0 0x400d5a8d:0x3ffb1f30 | |
| ARDUINO_DIR=$HOME/Documents/Arduino | |
| A2LINE=$ARDUINO_DIR/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-addr2line | |
| ELF=$(find /var/folders/ -name $INO.elf 2>/dev/null) | |
| INO=$1 | |
| shift |
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
| var https = require('https'); | |
| // Same as: | |
| // curl -H 'Content-Type: application-json' -d PARAMS | |
| // https://mdash.net/api/v2/devices/DEVICE_ID/rpc/METHOD?access_token=TOKEN | |
| var mdashRequest = function(apiToken, deviceID, method, params, func) { | |
| return new Promise(function(resolve, reject) { | |
| var received = ''; | |
| var strParams = JSON.stringify(params || {}); | |
| var url = 'https://mdash.net/api/v2/devices/' + deviceID + '/rpc/' + |
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 <mDash.h> | |
| #include <BLEDevice.h> | |
| #include <BLEUtils.h> | |
| #include <BLEScan.h> | |
| #include <BLEAdvertisedDevice.h> | |
| #define WIFI_NAME "XX" | |
| #define WIFI_PASS "YY" | |
| #define DEVICE_ID "d1" |