Skip to content

Instantly share code, notes, and snippets.


Germán Martín gmag11

View GitHub Profile
gmag11 / ip2mac.ino
Created Jan 2, 2022
Get MAC address from IP with ESP32
View ip2mac.ino
#include <WiFi.h>
#include "lwip/etharp.h"
const char* ssid = "xxxxxx";
const char* password = "xxxxxx";
const IPAddress remote_ip (192, 168, 1, 1); // Should be in your same subnet
void setup () {
from xml.dom import minidom
import re
import math
mydoc = minidom.parse('TweetCloud.xml')
items = mydoc.getElementsByTagName('a')
hashtags = []
gmag11 / mqtt_ssl_idf.ino
Last active May 14, 2022
Secure MQTT connection to broker with ESP32 and internal IDF mqtt client library
View mqtt_ssl_idf.ino
#include "Arduino.h"
#include <WiFi.h>
#include "esp_log.h"
#include "esp_system.h"
#include "esp_event.h"
#include "mqtt_client.h"
#define SECURE_MQTT // Comment this line if you are not using MQTT over SSL
gmag11 / nodered-ssl.conf
Last active Jul 25, 2021
NodeRed 1.0 reverse proxy configuration with Apache 2.4
View nodered-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html # this does not matter
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
gmag11 / rclone-mount@.service
Last active May 7, 2022
Mount multiple RClone remotes on boot with a single SystemD forking service definition
View rclone-mount@.service
# Rclone mount on boot
# Copy file to: /etc/systemd/system
# You need to create a remote on RClone and a folder on your disk, both with same name <rclone-remote>
# This example uses /cloud/ folder as origin to mount all remotes, change it to your needs
# This example use a linux user named rclone. Create it or adapt it to your needs. Rclone will get config from that user's home folder
# Register new service by typing:
# sudo systemctl daemon-reload
# Do the next one for every remote you want to load on boot
# sudo systemctl enable rclone-mount@<rclone-remote>.service
# systemctl start rclone-mount@<rclone-remote>.service
View Node-RED.service
# This script work on any system using systemd as the init process.
# It works on Debian/Raspbian Jessie.
# If you have Debian/Rapbian Wheezy and want to use this script with systemd
# follow the information here :
# To easily download, install and set at startup:
# wget -O /tmp/download && sudo tar -zxf /tmp/download --strip-components 1 -C /etc/systemd/system/ && sudo systemctl --reload-daemon && sudo systemctl enable Node-RED
# To consult the log : journalctl -u Node-RED
View ds18b20_test.ino
#include <Arduino.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port D2 on NodeMCU
#define ONE_WIRE_BUS D2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
gmag11 / CallbackTest.ino
Last active Jan 4, 2017
MyAsyncWebServer prototype. Some code errors inside.
View CallbackTest.ino
#include <ESPAsyncTCP.h>
#include <Ticker.h>
#include <ESPAsyncWebServer.h>
#include <ESP8266WiFi.h>
#include <functional>
#include <Hash.h>
using namespace std;
using namespace placeholders;