This file contains 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 <Adafruit_AHTX0.h> | |
#include <Adafruit_BMP280.h> | |
Adafruit_AHTX0 aht = {}; | |
Adafruit_BMP280 bmp = {}; // I2C | |
void setup() | |
{ | |
Serial.begin(115200); | |
while (!Serial) |
This file contains 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 to convert data URL to Blob | |
function data_URL_to_blob(data_url) | |
{ | |
var arr = data_url.split(','); | |
var mime = arr[0].match(/:(.*?);/)[1]; | |
var bstr = atob(arr[1]); | |
var n = bstr.length; | |
var u8arr = new Uint8Array(n); | |
while (n--) |
This file contains 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
"Create a single header C file": { | |
"prefix": "#header-single", | |
"body": [ | |
"#ifndef __${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H__", | |
"#define __${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H__", | |
"$0", | |
"#endif // __${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H__", | |
"", | |
"#ifdef ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_IMPLEMENTATION", | |
"#endif // ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_IMPLEMENTATION" |
This file contains 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
package main | |
import "core:fmt" | |
import SDL "vendor:sdl2" | |
SCREEN_WIDTH : i32 = 640 | |
SCREEN_HEIGHT : i32 = 480 | |
main :: proc() | |
{ |
This file contains 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
/** | |
* Returns an array of strings representing the sentences (where they break) | |
* in the given HTML element (.reading-word-container). | |
* Words are joined by spaces, and there are spaces after punctuation marks. | |
* | |
* @param {HTMLElement} html - The HTML element containing the sentences. | |
* @return {string[]} An array of strings representing the sentences. | |
*/ | |
function getSentences(html) | |
{ |
This file contains 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 os | |
import pysrt | |
import spacy | |
output_folder_name = "txt" | |
try: | |
os.mkdir("./{}".format(output_folder_name)) | |
except OSError: | |
pass # already exists |
This file contains 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
Uint32 SDL_Colour_To_Uint32(const SDL_Colour *col) | |
{ | |
// Must be format AABBGGRR for gfx library | |
return (Uint32)((col->a << 24) + (col->b << 16) + (col->g << 8) + (col->r << 0)); | |
} | |
SDL_Colour Uint32_To_SDL_Colour(const Uint32 colour) | |
{ | |
SDL_Colour tmp; | |
tmp.a = (colour >> 24) & 0xFF; |
This file contains 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 pysrt | |
import os | |
output_folder_name = "txt" | |
try: | |
os.mkdir("./{}".format(output_folder_name)) | |
except OSError: | |
pass # already exists |