Skip to content

Instantly share code, notes, and snippets.

@gbirke
gbirke / gls_cc_extract_recipient.py
Created March 23, 2023 20:51
Convert CSV credit card statements of GLS Bank to look more like bank statements
#!/usr/bin/env python3
import argparse
import csv
import os.path
import sys
import logging
import re
"""

Apache Proxy mit SSL-Client-Zertifikat für FHEM

Diese Anleitung beschreibt, wie ein Apache-Webserver als [Reverse Proxy][1] für eine [FHEM][2]-Installation eingerichtet wird. Bei der Einrichtung hatte ich folgende Ziele:

  • Erreichbarkeit von FHEM aus dem Internet (mit Host-Name per [Dynamic DNS][3])
  • Absichern der Kommunikation per SSL (mit selbst signiertem Zertifikat)
  • Zugriff ohne Passworteingabe, Absicherung per SSL-Client-Zertifikat

Disclaimer: Ich bin weder ausgewiesener Sicherheitsexperte noch Administrator, alle Tips hier habe ich mir aus diversen Tutorials zusammengesucht. Wer dringende Änderungswünsche oder Verbesserungsvorschläge hat, mailt an gb@birke-software.de

Voraussetzungen

  • Ein Raspberry Pi mit Raspbian oder die notwendige Intelligenz, alles was auf eurem System anders ist als unter Raspbian auch anders zu machen.
@gbirke
gbirke / Dockerfile
Last active February 25, 2022 08:46
Testing sequence support
FROM php:8.1-alpine
RUN set -ex \
&& apk --no-cache add postgresql-dev
RUN docker-php-ext-install pdo pdo_mysql pdo_pgsql
@gbirke
gbirke / Presentation.md
Last active February 21, 2022 16:12
Presentation on Clean Architecture in WMDE Fundraising
tags aliases created_on
2022-02-17

Clean Architecture and the Fundraising Application


What is the Clean Architecture

@gbirke
gbirke / get_seq.php
Last active February 21, 2022 09:22
Test LAST_INSERT_ID
<?php
# SQL setup:
# CREATE TABLE payment_sequence (id INT NOT NULL);
# INSERT INTO payment_sequence VALUES(0);
# CREATE TABLE payment_log(id INT PRIMARY KEY, client_id INT, loop_id INT, ts DATETIME(6));
$db = new PDO("mysql:dbname=fundraising;host=database", 'fundraising', 'INSECURE PASSWORD');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
@gbirke
gbirke / unserialize_decode.php
Created August 10, 2021 14:52
Decode PHP-serialized and base64 encoded data in CLI
#!/usr/bin/env php
<?php
if (!empty($argv[1])) {
$data = (string)$argv[1];
} elseif (!stream_isatty(STDIN)) {
$data = stream_get_contents(STDIN);
} else {
echo "Usage: $argv[0] <base64_encoded_serialized_data>\n";
exit(1);
@gbirke
gbirke / php.service
Created November 16, 2016 11:13
Example systemd config for local PHP server
[Unit]
Description=PHP Server
After=home.mount network.target
[Service]
User=vagrant
Group=vagrant
ExecStart=/usr/bin/php -S 127.0.0.1:8000 -t /vagrant/www
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
@gbirke
gbirke / MultiFeedExporter.py
Last active October 16, 2020 21:57
MultiFeedExporter.py
import inspect
import importlib
from datetime import datetime
from twisted.internet import defer
from scrapy import log
from scrapy.contrib.feedexport import FeedExporter, SpiderSlot
<?php
// This example shows how to override implementations without subclassing,
// using anonymous classes and traits.
interface Animal {
public function makeSound(): string;
public function move(): string;
}