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 char HTTPSERVER_GET_REQUEST_TEMPLATE[] PROGMEM = | |
"GET %s HTTP/1.1\r\n" | |
"Host: %s\r\n" | |
"User-Agent: KIOTDevice\r\n" | |
"Connection: keep-alive\r\n" | |
"Content-Type: application/json\r\n" | |
"\r\n"; | |
void _httpGetRaw(String path) { | |
if (_http_client == 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
bool checkUnreadMessage(bool changeStatusToRead = true, SMSARRAY {Takes a pointer to array of SMS structs} , uint8_t skip = 0,uint8_t limit = 10 ){ | |
sendAT(GF("+CMGL=\"REC UNREAD\","), static_cast<const uint8_t>(!changeStatusToRead)); | |
if (waitResponse(5000L, GF(GSM_NL "+CMGL: \"")) != 1) { | |
stream.readString(); | |
return {}; | |
} | |
// read Messages from this | |
use skip and limit to control what messages to be filled in the sms pointer | |
// SMSARRAY.push(SMS) |
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
let _arr = []; | |
let count = 0; | |
class Lock { | |
constructor() { | |
this._locked = false; | |
this._waiting = []; | |
} |
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
let p = new Promise((resolve,reject)=>{ | |
setTimeout(()=>{ | |
resolve("Hello"); | |
console.log("Will I be printed"); | |
}, 2000); | |
}); | |
p.then(data=>{ | |
console.log(data); | |
}).catch(err=>{ |
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
# Bunch of setting up Steps | |
pip install transformers[sentencepiece] | |
pip install sentencepiece | |
import os | |
# Load the Pretrained Model | |
from transformers import AutoTokenizer, AutoModelWithLMHead, PreTrainedModel | |
tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-finetuned-emotion", use_fast=False) | |
model = AutoModelWithLMHead.from_pretrained("mrm8488/t5-base-finetuned-emotion") |
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
from flask import Flask | |
from flask import request | |
app = Flask(__name__) | |
from mood_tagging import get_emotion | |
@app.route('/get_emotion', methods=['POST']) | |
def get_emotion_of_text(): | |
if request.method == 'POST': | |
text = request.json.get('text') |
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
# base Image | |
FROM python:3.6-stretch | |
# install build utilities | |
RUN apt-get update && \ | |
apt-get install -y gcc make apt-transport-https ca-certificates build-essential git | |
#Install Pytorch and dependencies | |
RUN pip3 install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html |
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 char *wifiSSID = "MY_WIFI"; | |
const char *wifiPassword = "MY_PASS"; | |
#define MQTT_HOST "mybroker" | |
#deinfe MQTT_PORT 1883 | |
#include <ESP8266WiFi.h> | |
WiFiClient wifiClient; | |
#include <AsyncMqttClient.h> | |
AsyncMqttClient mqttClient; |
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
Given an API - /all_data which returns all the schools, all the students and all the books from DB. And return the reponse with minimum possible latency. | |
And if any of the query fails, returns balnk array for only that entity. | |
Example - | |
router.get("/all_data", async (req,res,next)=>{ | |
let schools = await School.find(); // takes 300ms to complete | |
let students = await Student.find(); // takes 300ms to complete | |
let books = await Book.find(); // takes 300ms to complete | |
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 getIntersection(setA, setB) { | |
const intersection = new Set( | |
[...setA].filter(element => setB.has(element)) | |
); | |
return intersection; | |
} | |
// const set1 = new Set(['a', 'b', 'c']); | |
// const set2 = new Set(['a', 'b', 'd', 'e']); |
OlderNewer