Skip to content

Instantly share code, notes, and snippets.

View tcsullivan's full-sized avatar

clyne tcsullivan

View GitHub Profile
@tcsullivan
tcsullivan / wifi_credential_manager.cpp
Last active December 18, 2023 16:43
Arduino (ESP32) code for collecting and storing WiFi credentials
/**
* WiFi Credential Manager example
* Written by Clyne Sullivan.
*
* This Arduino sketch stores WiFi SSID and passkey information in non-volatile
* EEPROM in order to connect to a given network. If these credentials are not
* saved, an access point will be started with a web server allowing the user
* to input new credentials. The access point can also be started by grounding
* the "CredsResetPin" pin (default pin 0).
*
@tcsullivan
tcsullivan / day3.fth
Created January 18, 2025 14:18
Breakdown of day 3 solution for Advent of Code 2024
\ "string =", really a "starts with" check. Returns true if the first u2 characters
\ in c-addr2 match c-addr1.
: s= ( c-addr1 c-addr2 u2 -- b )
tuck compare 0= ;
\ Reads up to 99 digits from c-addr and parses them into a number. Returns the number
\ and c-addr2 which points to the character beyond the parsed number.
: get-number ( c-addr -- n c-addr2 )
99 0 s>d 2swap >number rot 2drop ;