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 / bash
Last active November 10, 2023 09:05
wget archive
### Mirror page (infinite recursion), download assets as well, add html extension to pagelinks, make links relative, wait one second after each request to avoid hitting rate limits, identify as archive crawler
wget --mirror --page-requisites --adjust-extension --convert-links --wait=1 --user-agent="Archive Crawler" https://www.example.com
### maybe you want/need to turn off checks for robots.txt as well: `--execute robots=off`
### Watch out for relative/absolute links, with or without www. Crawling »www.example.com«, but all links point to »example.com« will cause wget to mirror the first page URL ony, and not follow any more links.
### To allow multipe domains use `--span-hosts --domains=example.com,www.example.com,cdn.example.com`
@pixelbrackets
pixelbrackets / swiftmailer.php
Last active April 26, 2023 07:26
PHP Mail Transport Test - Swiftmailer & Symfony Mailer standalone scripts, instantly usable without frameworks
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// composer require swiftmailer/swiftmailer
require_once 'vendor/autoload.php';
// Create the Transport
@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 / 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 / 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 / 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 / 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-git-auth.md
Last active February 2, 2024 08:08
Manage GitHub & GitLab Credentials in Composer
@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 = [