Skip to content

Instantly share code, notes, and snippets.

View thomasvt1's full-sized avatar

Thomas van Tilburg thomasvt1

View GitHub Profile
@thomasvt1
thomasvt1 / MQTT_ESP8266_temperature_humidity.ino
Created October 12, 2016 17:18 — forked from balloob/MQTT_ESP8266_temperature_humidity.ino
Sketch for the ESP8266 to publish temperature and humidity values received from a DHT22 to MQTT
// Get ESP8266 going with Arduino IDE
// - https://github.com/esp8266/Arduino#installing-with-boards-manager
// Required libraries (sketch -> include library -> manage libraries)
// - PubSubClient by Nick ‘O Leary
// - DHT sensor library by Adafruit
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <DHT.h>
#include <ESP8266WiFi.h>
extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}
// SSID to connect to
static const char* ssid = "eduroam";
// Username for authentification
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup () {
// GetCode.ino
//
// Basic example for the TOTP library
//
// This example uses the opensource SwRTC library as a software real-time clock
// you can download from https://github.com/leomil72/swRTC
// for real implementation it's suggested the use of an hardware RTC
#include "sha1.h"
#include "TOTP.h"
@thomasvt1
thomasvt1 / device-tracker.php
Created November 8, 2017 15:48
Web(IFTTT)>MQTT Device Tracker usefull for Home Assistant
<?php
ini_set('display_errors', 1);
require("phpMQTT.php");
$key = "XXXXX"; // The API key
$server = "XXXXX"; // change if necessary
$port = XXXXX; // change if necessary
$username = "XXXXX"; // set your username
$password = "XXXXX"; // set your password
import bluetooth
import threading
import requests
from time import sleep
import RPi.GPIO as GPIO
#Set up GPIO
GPIO.setmode(GPIO.BCM)
from bluetooth import *
import sys
import RPi.GPIO as GPIO
import time
import random
#If using python 2
if sys.version < '3':
input = raw_input
<?php
/**
* Processes the message requested
*
* @param $update
*/
function processMessage($update)
switch ($update["queryResult"]["action"]) {
@thomasvt1
thomasvt1 / your-plugin-name.php
Last active February 1, 2019 07:49
Wordpress demo plugin
<?php
/*
Plugin Name: Your plugin name goes here.
Plugin URI: Your website/blog address goes here.
Description: Removes unnecessary clutter from WPHead.
Version: 1.0.0
Author: Your name goes here.
Author URI: Your website/blog address goes here.
*/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE params SYSTEM "params.dtd">
<params name="Practice">
<section name="Header">
<attstr name="name" val="Practice"/>
<attstr name="description" val="Practice"/>
<attnum name="priority" val="100"/>
<attstr name="menu image" val="data/img/splash-practice.png"/>