Skip to content

Instantly share code, notes, and snippets.

View erikcorry's full-sized avatar
🏠
Working from home

Erik Corry erikcorry

🏠
Working from home
View GitHub Profile
@erikcorry
erikcorry / huge-regexp.js
Created June 18, 2024 12:32
Huge regexp test for bug 40261789
const terms = `\u0446\u0435\u043b\u044c\u044e|\u0446\u0435\u043b\u044c \u0438\u0441\u0441\u043b\u0435|\u0440\u0435\u0437\u044e\u043c\u0435|\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442|\u043f\u0440\u0435\u0434\u043c\u0435\u0442|\u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430|\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b|\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0438 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0430|\u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438|\u0432\u044b\u0432\u043e\u0434|\u0432\u0432\u0435\u0434\u0435\u043d\u0438|\u0426\u0435\u043b\u044c|\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b|\u041c\u0435\u0442\u043e\u0434\u044b|\u041a\u0440\u0430\u0442\u043a\u0438\u0435 \u0438\u0442\u043e\u0433\u0438|\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435|\u0412\u044b\u0432\u043e\u0434\u044b|\u0412\u0438\u0441\u043d\u043e\u0432\u043a\u0438|\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435|\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f|\

Memory use, performance, and Toit pixel display.

(March 2024).

Some applications using pixel displays may run out of memory, especially if you are running on a small ESP32 with no external PSRAM. This is especially the case if you are using the small jaguar server on the device for fast edit-compile-run development cycles.

/// Simple pretty-printer for JSON-compatible objects (maps, lists, strings,
/// numbers, booleans, and null).
pretty-print data --indent/string="" --prefix/string?=null --suffix/string?="" -> none:
str := json.stringify data
if str.size < 80:
print "$(prefix or indent)$str$suffix"
return
if data is Map:
print "$(prefix or indent){"
i := 0
#
# Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
#
CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined"
CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined"
CONFIG_SOC_DPORT_WORKAROUND="Not determined"
CONFIG_SOC_CAPS_ECO_VER_MAX=301
CONFIG_SOC_ADC_SUPPORTED=y
CONFIG_SOC_DAC_SUPPORTED=y
@erikcorry
erikcorry / esp-idf-march-august.diff
Created August 16, 2023 14:30
IRAM sizes esp-idf march 2023 to august
--- rolled-sizes.txt 2023-08-16 16:23:09.982969715 +0200
+++ unrolled-sizes.txt 2023-08-16 16:22:34.159637286 +0200
@@ -1,33 +1,33 @@
Total sizes:
-Used static DRAM: 49824 bytes ( 74756 remain, 40.0% used)
- .data size: 22008 bytes
- .bss size: 27816 bytes
-Used static IRAM: 132298 bytes ( -1226 remain, 100.9% used) Overflow detected!
- .text size: 131271 bytes
+Used static DRAM: 50092 bytes ( 74488 remain, 40.2% used)
@erikcorry
erikcorry / Save session data.diff
Created July 21, 2023 13:31
Save session data between TLS connecitons.
Author: Kasper Lund <[email protected]>
Date: Mon Jun 12 13:14:22 2023 +0200
Store TLS session data in RTC memory (#715)
diff --git a/src/service/brokers/http/connection.toit b/src/service/brokers/http/connection.toit
index 35ad787..e5b9888 100644
--- a/src/service/brokers/http/connection.toit
+++ b/src/service/brokers/http/connection.toit
@@ -6,9 +6,9 @@ import http
diff --git a/examples/bubble_sort.toit b/examples/bubble_sort.toit
index 0ceee960..d28172d0 100644
--- a/examples/bubble_sort.toit
+++ b/examples/bubble_sort.toit
@@ -11,8 +11,8 @@ main:
bubble_sort a:
size := a.size
- for i := 0; i < size; i++:
+ for i := ..size:
diff --git a/include/mbedtls/compat-1.3.h b/include/mbedtls/compat-1.3.h
index 40177512c..efa1f78bb 100644
--- a/include/mbedtls/compat-1.3.h
+++ b/include/mbedtls/compat-1.3.h
@@ -2390,6 +2390,7 @@
#define ssl_set_sni mbedtls_ssl_conf_sni
#define ssl_set_transport mbedtls_ssl_conf_transport
#define ssl_set_truncated_hmac mbedtls_ssl_conf_truncated_hmac
+#define ssl_set_record_size_limit mbedtls_ssl_conf_record_size_limit
#define ssl_set_verify mbedtls_ssl_conf_verify
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 058e61b..c16551d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,7 +127,7 @@ if ("${TOIT_SYSTEM_NAME}" MATCHES "esp32")
set(MBEDTLS_C_FLAGS "-DMBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\"")
else()
# These constants should stay in sync with the ones in the sdkconfig file of the ESP32 toolchain.
- set(MBEDTLS_C_FLAGS "-DMBEDTLS_SSL_IN_CONTENT_LEN=8100 -DMBEDTLS_SSL_OUT_CONTENT_LEN=3700 -DMBEDTLS_PLATFORM_MEMORY=1")
+ set(MBEDTLS_C_FLAGS "-DMBEDTLS_SSL_IN_CONTENT_LEN=8100 -DMBEDTLS_SSL_RECORD_SIZE_LIMIT=1 -DMBEDTLS_SSL_DEBUG_ALL=1 -DDEBUG_TLS=1 -DMBEDTLS_SSL_OUT_CONTENT_LEN=3700 -DMBEDTLS_PLATFORM_MEMORY=1")
// Copyright (C) 2021 Toitware ApS.
// Use of this source code is governed by a Zero-Clause BSD license that can
// be found in the EXAMPLES_LICENSE file.
import http
import net
import net.x509
import certificate_roots
main: