Skip to content

Instantly share code, notes, and snippets.

View pixelbrackets's full-sized avatar
🧑‍🎓
Looking at other things right now

Dan Kleine (geb. Dan Untenzu) pixelbrackets

🧑‍🎓
Looking at other things right now
View GitHub Profile
@pixelbrackets
pixelbrackets / README.md
Last active February 10, 2022 11:42
Composer Test Dev Depdendency

ACME DevTool

A package intended for usage during development

image

@pixelbrackets
pixelbrackets / pass-php-version-to-subscripts-in-cli-calls.md
Last active February 10, 2022 11:29
Pass a specific PHP version to subscripts in a CLI call

Pass a specific PHP version to subscripts in a CLI call

Origin

Using the PPA ondrej/php it is possible to run multiple PHP version on one system.

All single versions are useable on the CLI, e.g. php7.4 --version. The command php will point to the default version.

Problem

@pixelbrackets
pixelbrackets / composer.json
Last active February 10, 2022 11:12
php-version-pickup
{
"name": "pixelbrackes/php-version-pickup",
"description": "Set a PHP version used in a shell session through a `.php-version` file",
"type": "project",
"license": "GPL-2.0-or-later"
}
@pixelbrackets
pixelbrackets / main.yaml
Created February 1, 2022 10:05
php-version-pickup Ansible Role
---
- name: Download/Update php-version-pickup
git:
repo: https://github.com/webit-de/php-version-pickup.git
dest: /home/{{ username }}/.php-version-pickup
clone: yes
update: yes
- name: Source script
@pixelbrackets
pixelbrackets / notes.md
Last active December 3, 2021 14:39
999+ New Messages - How to handle information overload
@pixelbrackets
pixelbrackets / php-password-hash
Created September 7, 2021 13:12
PHP Password Hash Creator
#!/usr/bin/env php
<?php
echo 'Password: ' . PHP_EOL;
fscanf(STDIN, '%s', $password);
$passwordHash = password_hash($password, PASSWORD_ARGON2I);
echo 'Hash: ' . PHP_EOL;
echo $passwordHash . PHP_EOL;
$result = password_verify($password, $passwordHash);
@pixelbrackets
pixelbrackets / quicklog.php
Last active August 30, 2021 11:59
Simple PHP log method
<?php
$data = ['foo' => 'Hello World'];
file_put_contents('/tmp/log.txt', time() . ' ' . print_r($data, true) . PHP_EOL, FILE_APPEND);
@pixelbrackets
pixelbrackets / date-prototype.html
Created February 25, 2021 11:06
Date Formats (2017-02-21)
Valid till: <span class="datetime" data-datetime="2017-02-21 17:00">2017-02-21 17:00 (GMT)</span>
<script>
// Given: Date and time in UTC timezone and international format
// Returned: Date and time in local timezone and international format
// Note: Returning localised date formats is not possible in JavaScript
// without the help of a library like moment.js!
// Extend date object with format method
@pixelbrackets
pixelbrackets / test-firewall.php
Created February 25, 2021 10:50
Test Firewall - Minimal script to prove to hosters that access to certain domains is not possible
<?php
// composer require guzzlehttp/guzzle
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client(['timeout' => 2]);
$urls = [
@pixelbrackets
pixelbrackets / git_commit_message_format.md
Last active February 3, 2021 03:24
GIT Commit Message Format

Commit Message Format

[FEATURE] Short summary of changes introduced by this patch

More detailed explanatory text, if necessary. Wrap it to ca 74 characters.
The first line is treated as the subject of the commit message and
the rest of the text as the body. The blank line separating the
subject from the body is critical (unless you omit the body entirely).

Write your commit message in the imperative present tense ("Fix bug"