Skip to content

Instantly share code, notes, and snippets.

View jaks6's full-sized avatar

Jakob Mass jaks6

  • University of Tartu
  • Estonia
View GitHub Profile
@jaks6
jaks6 / sun_clock.py
Created March 24, 2025 13:50
XFCE GenMon Sunlight Clock
import datetime
import matplotlib.pyplot as plt
import numpy as np
from astral import LocationInfo
from astral.sun import sun
from dateutil import tz
#
# Inspired by: https://daylight.franzai.com/
#
@jaks6
jaks6 / sensor_publisher.ino
Created June 18, 2020 12:00
ESP32-DHT11-MQTT-THINGSPEAK_SLEEP
/*
Basic ESP32 MQTT Analog Sensor Publisher
*/
#define BUILTIN_LED 2
#define DHTTYPE DHT11 // DHT 11
#define DHTPIN 15 // Digital pin connected to the DHT sensor
#define uS_TO_S_FACTOR 1000000ULL /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 300 /* Time ESP32 will go to sleep (in seconds) */
@jaks6
jaks6 / NiFi_Flow.json
Created May 15, 2020 14:04
NiFi Cumulocity WebSocket Measurement Subscription
{
"flowContents": {
"identifier": "21cdd1dd-d4cb-3bb9-872f-e66cdbcf8738",
"name": "NiFi Flow",
"comments": "",
"position": {
"x": 0.0,
"y": 0.0
},
"processGroups": [],
@jaks6
jaks6 / fogflow_sensor.py
Last active November 16, 2018 14:35
CPU usage sensor example for FogFlow (uses psutil python module)
#!/usr/bin/env python
# Based on https://github.com/smartfog/fogflow/tree/master/application/device
# Note: Uses psutil! https://psutil.readthedocs.io
import json
import psutil
import requests
import signal
import sys
import time
@jaks6
jaks6 / wemos.ino
Last active December 28, 2018 10:04
Extremely Simple WeMos D1 MQTT Cumulocity Example
// This example was created for Wemos D1 Rev.1
// Using a HC-SR501 PIR MOTION DETECTOR as the sensor.
// Using MQTT library by Joël Gähwiler
// https://github.com/256dpi/arduino-mqtt
#include <ESP8266WiFi.h>
#include <MQTT.h>
const char ssid[] = "xxxxxxxxx";
@jaks6
jaks6 / mqtt-publisher.ino
Created October 12, 2017 15:17
Arduino Analog temp. sensor MQTT publisher
#include <TinkerKit.h> // For simple Celsius conversion
#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
// MQTT
IPAddress server(192,168,0,101);
char topic[] = "arduino/temp/thermistor";
String str;
char charVal[4];