Skip to content

Instantly share code, notes, and snippets.

View tablatronix's full-sized avatar

Shawn A tablatronix

View GitHub Profile
@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 / 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
// .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
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(4, 4, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
@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()
@tablatronix
tablatronix / GetSimple\admin\inc\basic.php
Last active April 11, 2017 16:15 — 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 / 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.
*
uint8_t *pixels; // global pixel array
uint8_t NUMPIXELS = 8; // number of leds/pixels
uint8_t NUMBYTES = 3; // bytes per pixel, RGBW = 4, RGB = 3
uint16_t BUFFBYTES = NUMPIXELS*NUMBYTES; // bytes to allocate for pixel array
void allocPixelArray(uint8_t numPixels,uint8_t numBytes){
NUMPIXELS = numPixels;
NUMBYTES = numBytes;
BUFFBYTES = numPixels*numBytes;
Serial.println("allocating " + (String)BUFFBYTES + " bytes");
@tablatronix
tablatronix / configfragment.js
Last active June 17, 2017 15:09
getsimple ckeditor upload handler
// add to config.js editorconfig section. you can add ?path= query to this to use a subfolder
config.imageUploadUrl = "../admin/upload.php"
// add to config.js
CKEDITOR.on( 'instanceReady', function( ev ) {
// code for fileupload and response
ev.editor.on( 'fileUploadRequest', function( evt ) {
var fileLoader = evt.data.fileLoader,
formData = new FormData(),
xhr = fileLoader.xhr;
@tablatronix
tablatronix / esptelnetansi.ino
Created August 25, 2016 14:52
Arduino ESP8266 telnet server with some ansi experiments
/**
* Arduino ESP8266 telnet server with some ansi experiments
* @author: shawn_a
*/
#include <ESP8266WiFi.h>
#include <Arduino.h>
/* Set these to your desired AP credentials. */
const char *APssid = "ESPap";