Skip to content

Instantly share code, notes, and snippets.

View brainfoolong's full-sized avatar
:octocat:
Servus

Roland Eigelsreiter brainfoolong

:octocat:
Servus
  • CEO of Nullix, LeadDev @ Caritas St. Pölten
  • Austria, St. Pölten
View GitHub Profile
@brainfoolong
brainfoolong / Caddy Server PHP FCGI - Load Balance one upstream - Prevent 502 errors.md
Last active November 24, 2025 15:02
Caddy Server PHP FCGI - Load Balance one upstream - Prevent 502 errors

If you are using caddy and you have a FCGI handler running on a port (that even automatically restarts after close), you probably will be confrontend with 502 errors when one FCGI stops and the next restarts.

On windows, FCGI default closes after 500 requests, which you can increase but it does not properly solve the issue, it just delays it.

In caddy, you can load balance between the same upstreams to easily wait for the next upstream to restart.

This config balances between same upstreams and gracefully retry a few times (each 250ms for 5s) to serve the request.

Caddy config:

@brainfoolong
brainfoolong / url-params-converter.js
Last active October 13, 2025 07:49
Javascript URLSearchParams <-> JS Object converter (multidimensional)
class BrainsUrlParamsConverter {
/**
* Convert any object to URLSearchParams
* @param {Object} object
* @returns {Object}
*/
static objectToUrlSearchParams (object) {
if (typeof object !== 'object' || !object) {
return
}
@brainfoolong
brainfoolong / welcome-to-cstp.txt
Last active May 15, 2025 11:07
Welcome to CSTP
Servus und Grüß dich!
Wir, das Software Team der Caritas St. Pölten suchen dich.
Wenn du bis hierher gekommen bist, wirst du diese kleine Hürde sicher auch meistern können.
PHP Entwicklung ist ein Core-Feature, das wir von dir erwarten.
Deswegen dürfte es kein Problem sein, wenn du folgenden Code für uns ausbesserst und ausführst.
Wir brauchen dann bitte die wortgetreue Ausgabe des Scriptes in deinem Bewerbungstext.
0101010001110010011001010110111001101110011011000110100101101110011010010110010100001010
@brainfoolong
brainfoolong / podman-windows-wsl.md
Last active March 12, 2026 12:10
Install Podman Desktop on Windows 11 + WSL Installation + Podman Desktop showing WSL containers

If you are in my boots, starting using podman for the first time and want it to get it working on Windows and WSL, this is for you. It's a bit of a pain to have the same "Docker Desktop" experience just with "Podman Desktop".

This guide doesn't matter for security, it just documents how you make things work.

This guide only works for ubuntu 24 in your WSL distro. Versions bellow have older podman versions which are not compatible with podman desktop.

What we do

  • Remove Docker Desktop if installed
{
"2024-01": 8.137,
"2024-02": 6.293,
"2024-03": 5.776,
"2024-04": 4.655,
"2024-05": 4.655,
"2024-06": 4.655,
"2024-07": 5.339,
"2024-08": 5.827,
"2024-09": 6.038,
@brainfoolong
brainfoolong / bitmask.js
Created August 8, 2021 15:48
BitMask Demo
let CUTE = 1
let ANGRY = 2
let HUNGRY = 4
let CAT = ANGRY | HUNGRY
// angry only would be: let CAT = ANGRY
// cute, angry and hungry would be: let CAT = CUTE | ANGRY | HUNGRY
if (CAT & HUNGRY) {
console.log('Yeah my cat is hungry')
@brainfoolong
brainfoolong / obs-stopwatch.html
Last active June 21, 2021 07:22
A simple stopwatch for your recordings in OBS Studio
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Brains Easy OBS Stopwatch</title>
</head>
<body>
<span id="watch"></span>
<script>
(function () {