Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
heiglandreas / ldap_auth.php
Last active April 15, 2024 06:46
LDAP-Authentication
<?php
/**
* This gist expects the following parameters
*
* @param string $ldapURI The LDAP-Uri. Something like ldaps://example.com:636 or ldap://example.com/396
* @param string|null $rdnUsername The DN of a user with read-credentials to the LDAP. Not necessary for anonymous bind.
* @param string|null $rdnPassword THe password of the $rdnUsername
* @param string|null $filter THe filter to be used to find the user in the LDAP
*/
@heiglandreas
heiglandreas / install.sh
Last active February 13, 2024 16:43
Set up an ubuntu docker container with google-authenticator so that you can get a 2FA config file
docker run -it --rm ubuntu
apt update
apt install curl build-essential autoconf libtool vim libpam-dev
curl -LO https://github.com/google/google-authenticator-libpam/archive/refs/tags/1.09.tar.gz
tar xvzf 1.09.tar.gz
cd google-authenticator-libpam-1.09/
./bootstrap.sh
./configure
# This will break at some points. Check the script and fix it.
<?php
namespace Test;
enum Locale: string
{
case en_GB = 'en_GB';
case de_DE = 'de_DE';
case fr_CA = 'fr_CA';
{
"require": {
"symfony/security-bundle": "^6.3"
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1"
}
}
Calendar buddhist
Calendar chinese
int(1)
int(1)
Calendar coptic
Calendar dangi
int(1)
int(1)
Calendar ethiopic
Calendar ethiopic-amete-alem
@heiglandreas
heiglandreas / expected result
Last active April 19, 2023 18:58
SImple test of Intl-Calendar feature set(month)
Chinese Calendar
int(1)
int(0)
Islamic Calendar
int(8)
int(0)
Gregorian Calendar
int(3)
int(0)
@heiglandreas
heiglandreas / ci-fail.yml
Last active March 26, 2023 13:03
Patch-Coverage as GitHub Action
jobs:
patch-coverage:
# Fail when untested lines are found
steps:
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
tools: "phive"
coverage: "xdebug"
- name: "Install tools"
<?php
use Org_Heigl\Holidaychecker\Holidaychecker;
use Org_Heigl\Holidaychecker\HolidayIteratorFactory;
$factory = new HolidayIteratorFactory();
$iterator = $factory->createIteratorFromISO3166('DE');
$checker = new Holidaychecker($iterator);
$startDate = new DateTimeImmutable('2022-10-10');
<?php
class ClassToTestA
{
public function __construct(private ClockInterface $clock) {}
public function do(): void
{
$a = $this->clock->now();
sleep(6);