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.
*
#include <avr/sleep.h>
// const int com[4] = { 10, 13, 14, 4 };
// const int com[4] = { 4, 14, 13, 10 };
// const int dig[8] = { 11, 15, 6, 8, 9, 12, 5, 7 };
// const int dig[8] = { 13, 17, 4, 6, 7, 14, 3, 5 };
// const int num[10] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f };
// int nmd[10] = {};
// int nmb[10] = {};
#items { overflow: hidden !important; }
*:not(.yt-chat-badge):not(.yt-emoji-icon) { background: transparent !important; }
.gaming-promo, #live-comments-controls, ::-webkit-scrollbar, wbr, .is-deleted, [is-deleted], #panel-pages, yt-live-chat-header-renderer { display: none !important; }
#author-name, #message { color: white !important; text-shadow: -0.5px -0.5px 0 black, 0.5px -0.5px 0 black, -0.5px 0.5px 0 black, 0.5px 0.5px 0 black !important; }
#message { display: block !important; }
#author-name::after { content: ":"; font-weight: 900; }
#message a {color: skyblue !important; font-size: 0 !important; line-height: 9px !important;}
#message a::after { content: attr(href); font-size: 10px !important; }
@keyframes chat-fade { 0% { opacity: 1; position: relative; } 99% { opacity: 0; position: relative; } 100% { opacity: 0; position: absolute; }}
yt-live-chat-text-message-renderer { animation: chat-fade 5s 30s forwards; }

Push an individual file from a repo to a new repo and keep command history associated with that file:

git clone <original repo url> temp-repo
cd temp-repo
git remote rm origin
git rm -rf .
git checkout HEAD -- <filename>
git commit -m "<commit message>"
git remote add origin <new repo url> # comments
git pull 
@vidavidorra
vidavidorra / auto-deploy_documentation.md
Last active June 5, 2024 19:20
Auto-deploying Doxygen documentation to gh-pages with Travis CI

Auto-deploying Doxygen documentation to gh-pages with Travis CI

This explains how to setup for GitHub projects which automatically generates Doxygen code documentation and publishes the documentation to the gh-pages branch using Travis CI. This way only the source files need to be pushed to GitHub and the gh-pages branch is automatically updated with the generated Doxygen documentation.

Sign up for Travis CI and add your project

Get an account at Travis CI. Turn on Travis for your repository in question, using the Travis control panel.

Create a clean gh-pages branch

To create a clean gh-pages branch, with no commit history, from the master branch enter the code below in the Git Shell. This will create a gh-pages branch with one file, the README.md in it. It doesn't really matter what file is uploaded in it since it will be overwritten when the automatically generated documentation is published to th

@chaeplin
chaeplin / wifi_test.ino
Created February 16, 2016 15:31
wifi_test.ino
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "/usr/local/src/ap_setting.h"
extern "C" {
#include "user_interface.h"
}
char* topic = "wifitest";
int test_para = 5000;
/*
ffmpeg -i "$file" -f s32be -acodec pcm_s32be -ar 44100 -af "volume=0.5" tcp://espip:5522
*/
#include "i2s.h"
#include <ESP8266WiFi.h>
const char* ssid = "***********";
const char* password = "**********";
WiFiServer pcmServer(5522);
static WiFiClient pcmClient;
@sgnl
sgnl / _notes.md
Last active August 26, 2022 03:03
AJAX with Vanilla Javascript. (XMLHttpRequest)

Short XHR Examples

Examples shown are bare minimum needed to achieve a simple goal.

Resources

  • Google Chrome's Dev Tools' Network Panel c-c-c-c-c-ULTIMATE c-c-c-COMBO!!!
  • requestb.in enpoints for your HTTP Requests as a free service.
function loadIp($host){
$filepath = "/dev/shm/ipcache";
$ip = gethostbyname($host);
$wfile = fopen($filepath, "w");
fwrite($wfile, $ip);
fclose($wfile);
return $ip;
}
function getIp($host)
@zerog2k
zerog2k / user_main.c
Last active June 27, 2023 17:50
acurite 5n1 weather station decode over 433 mhz ask rx module on esp8266
/*
// acurite 5n1 weather station (VN1TXC)
// decoding over 433MHz ASK superhet RX module
// on ESP8266 SDK
//
// Jens Jensen, 2015
//
// todo: emit wx packets as json
// todo: add webserver code
*/