Skip to content

Instantly share code, notes, and snippets.

View aovestdipaperino's full-sized avatar

Paperinik aovestdipaperino

View GitHub Profile
@aovestdipaperino
aovestdipaperino / main.c
Created August 5, 2022 16:44
RPM sensor - first draft
#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h>
U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(/* clock=*/PIN_WIRE_SCL, /* data=*/PIN_WIRE_SDA, /* reset=*/U8X8_PIN_NONE); // OLEDs without Reset of the Display
#define REED_SWITCH D10
unsigned long rpms = 0;
void tick()
{
static uint64_t previousTick = 0;
#include "soc/rtc_wdt.h"
void __attribute__((noreturn)) call_start_cpu0(void)
{
rtc_wdt_protect_off(); //Disable RTC WDT write protection
//Set stage 0 to trigger a system reset after 1000ms
rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_RTC); // RTC_WDT_STAGE_ACTION_RESET_SYSTEM for regular reset.
rtc_wdt_set_time(RTC_WDT_STAGE0, 4000);
rtc_wdt_enable(); //Start the RTC WDT timer
rtc_wdt_protect_on(); //Enable RTC WDT write protection
@aovestdipaperino
aovestdipaperino / battery.c
Created November 20, 2021 23:21
Log Battery voltage vs. time
#include <Arduino.h>
#include <ArduinoNvs.h>
const bool LOG = true;
uint16_t minutesSinceBoot = 0;
bool doLogging = false;
void setup()
{
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(2, OUTPUT);
@aovestdipaperino
aovestdipaperino / notifications.swift
Last active November 1, 2021 21:20
How to send discreet notifications
// The author disclaims copyright to this source code. In place of
// a legal notice, here is a blessing:
//
// May you do good and not evil.
// May you find forgiveness for yourself and forgive others.
// May you share freely, never taking more than you give.
class YourViewController : UIViewController {
// add this method.
func sendDiscreetNotification(message: String) {
@aovestdipaperino
aovestdipaperino / certificate.cpp
Created February 4, 2020 06:00
Read X509 Certificate expiration date
char buf[32];
std::string ReadExpirationDate(X509* certificate)
{
std::string timeString;
BIO* bmem = BIO_new(BIO_s_mem());
if (ASN1_TIME_print(bmem, X509_get_notAfter(certificate))) {
BUF_MEM* bptr;