Skip to content

Instantly share code, notes, and snippets.

@stephanhuewe
stephanhuewe / flow.yml
Created December 1, 2023 10:50
Solar Awtrix Flow
---
blueprint:
name: AWTRIX Solar Energy Monitor
description: >
This blueprint will show the current solar energy received.
It uses a icons 54156 (solar-green), 50557 (solar-white-dyn), 50546 (solar-static) that you need to install.
domain: automation
input:
@stephanhuewe
stephanhuewe / header.html
Created November 9, 2023 21:39
A small javascript file to extract from, to and envelope-to from a mail header. Used at www.spambarrier.de
<script type="text/javascript">
function validate()
{
const regexpEnvelope = /envelope-from.*/g;
const regexpFrom = /From:.*>/g;
const regexpTo = /\nTo: .*/g;
var headerText = document.getElementById("txt").value;
const matchesEnvelope = headerText.matchAll(regexpEnvelope);
const matchesFrom = headerText.matchAll(regexpFrom);
const matchesTo = headerText.matchAll(regexpTo);
@stephanhuewe
stephanhuewe / dns.php
Last active May 18, 2023 08:53 — forked from horsley/dns.php
Simple PHP code act as a dig tool to find dns records (using specific given nameservers)
<?php
$result = array();
$result_html = '';
function getDnsRecords($domain) {
$result = array();
$servers = array("8.8.8.8", "8.8.8.8", "8.8.8.8", "8.8.8.8", "8.8.8.8", "8.8.8.8", "8.8.8.8", "8.8.8.8");
foreach ($servers as $server) {
$dnsResult = dns_get_record_from($server, "A", $domain);
@stephanhuewe
stephanhuewe / mysql database to bootstrap table.php
Created April 8, 2021 15:29 — forked from quickgrid/mysql database to bootstrap table.php
Pulls data from mysql database and show in beautiful bootstrap table.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sample PHP Database Application</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
</head>
@stephanhuewe
stephanhuewe / .gitlab-ci.yml
Created June 30, 2020 08:55 — forked from ChugunovRoman/.gitlab-ci.yml
Deploy Electron app with gitlab ci
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/download?job=pages
# https://<example.com>/<namespace>/<project>/-/jobs/artifacts/<tag>/raw/<path_to_file>?job=pages
# Where:
# example.com - domain name your gitlab server
# namespace - your name user on the gitlab
# project - your project
# tag - ref of current job.
# If job run on only by tags, than ref will be named as tag name
# If job run on only master, than ref will be named as "master", i.e.: https://<example.com>/<namespace>/<project>/-/jobs/artifacts/master/download?job=pages
# path_to_file - path to file relative from root workspace folder
@stephanhuewe
stephanhuewe / gist:2c1df7bae3fce8d43949feb3baadc53e
Created May 20, 2020 16:04 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@stephanhuewe
stephanhuewe / cl_ReadJSON.pas
Created May 15, 2020 16:04 — forked from adilsoncarvalho/cl_ReadJSON.pas
Parsing JSON on Delphi (the ugly way)
unit cl_ReadJSON;
interface
uses System.Json, System.SysUtils, Vcl.Dialogs, System.Classes;
procedure ReadJSON;
implementation
@stephanhuewe
stephanhuewe / HauntedHouse.java
Created December 15, 2019 13:36 — forked from ivstuart/HauntedHouse.java
HauntedHouse
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Haunted House Adventure
* Original BASIC version from the 1983 Usborne computer book
* Write Your Own Adventure Programs for Your Microcomputer
Example infrastructure outage incident report
Friday, May 13, 2077
By the Example Security Team
Earlier this week we experienced an outage in our API infrastructure. Today we’re providing an incident report that details the nature of the outage and our response.
The following is the incident report for the Example Security outage that occurred on April 30, 2077. We understand this service issue has impacted our valued developers and users, and we apologize to everyone who was affected.
@stephanhuewe
stephanhuewe / phat-clock.py
Created October 6, 2018 09:53 — forked from jan-martinek/phat-clock.py
Simple clock for raspberry pi + Unicorn pHAT
#!/usr/bin/env python
# H | M*10 | M
# 1 5 9 | 1 5 | 1 5 9
# 2 6 10 | 2 | 2 6
# 3 7 11 | 3 | 3 7
# 4 8 12 | 4 | 4 8
import time
import unicornhat as unicorn