Skip to content

Instantly share code, notes, and snippets.

View tablatronix's full-sized avatar
🎄

Shawn A tablatronix

🎄
View GitHub Profile
@tablatronix
tablatronix / resetaction.ino
Last active July 8, 2023 13:54
example to use eeprom to store reset states to trigger an action on purposeful resets
/**
* detect mutiple resets in order to trigger events using resets or power cycles alone
* reset board within resettimeout(5000ms) after boot and do so resetcnt(4) times
* has led indicator of reset window and serial output for better clarity
*
* This is blocking using a delay for timeout, can easily be changed to use a timer
* This is not wear leveled, but you could replace with spiffs(slower), or use a ring counter to level it
* You could also add a smaller window for reset by adding a pre-delay, to prevent reduce flash writes during glitchy or fast power cycles
* either way USE WITH CAUTION as you are writing twice every time your reset or repower the board, soft resets and wdt should not trigger this however.
*
@tablatronix
tablatronix / GetSimple\admin\inc\basic.php
Last active June 5, 2024 04:19 — forked from FL-Retiree/GetSimple\admin\inc\basic.php
GetSimple/SMTP Mail Functionality
<?php
/* ----------------------------------------------------------------------
This code fragment and addition to the GetSimple config file is designed to provide the capability to use SMTP mail when sending from
the GetSimple core application, not from plugins. For example, when sending a mail generated by a user request to "Reset Password"
GetSimple uses the built in PHP Mail() function only. Many hosting environments are now requiring that PHP scripts only use SMTP for
security reasons and thus this suggested change...
-------------------------------------------------------------------------
STEP #1 -
Add the following 2 lines to GSConfig.php:
@tablatronix
tablatronix / nofollow.php
Created December 29, 2017 15:01
mybb nofollow plugin fixed
<?php
// This plugin is licensed under the GNU GPLv3 license
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.");
}
$plugins->add_hook("parse_message_end", "AddNoFollow_hook");
function AddNoFollow_info()
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(4, 4, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
// .h
#ifdef whatnot
std::unique_ptr<classA> theclass;
#else
std::unique_ptr<classB> theclass;
#endif
// .cpp
// How can I avoid using the actual classnames here
#ifdef whatnot
@tablatronix
tablatronix / AutoConnectWithHTTPServer.ino
Last active March 4, 2018 15:14 — forked from tzapu/AutoConnectWithHTTPServer
WiFiManager auto connect and start a http web server
#include "WiFiManager.h" //https://github.com/tzapu/WiFiManager
#if defined(ESP32)
#include <WebServer.h>
using my_WebServer = WebServer;
#else
#include <ESP8266WebServer.h>
using my_WebServer = ESP8266WebServer;
#endif
@tablatronix
tablatronix / debugport.cpp
Created March 4, 2018 16:33
ondemaptconfigportal debugport
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
// select which pin will trigger the configuration portal when set to LOW
// ESP-01 users please note: the only pins available (0 and 2), are shared
// with the bootloader, so always set them HIGH at power-up
#define TRIGGER_PIN 0
const char* modes[] = { "NULL", "STA", "AP", "STA+AP" };
// WiFiManager wifiManager;
@tablatronix
tablatronix / stplugins.md
Last active March 30, 2018 15:35
sublime text plugins

Programming

web

bootstrap snippets

browser referesh

color highlighter(buggy)

indent xml

@tablatronix
tablatronix / xml.php
Last active April 3, 2018 16:43
cannot print xml sub collection
<?php
// why does print_r($xmlobj->node) only print the first node ?
$string = <<<XML
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>
Two of our famous Belgian Waffles with plenty of real maple syrup
@tablatronix
tablatronix / htmlescape.php
Last active April 5, 2018 14:05
html excape examples
<script>
// https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
escaped = new Option(unescaped).innerHTML;
var entityMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',