Skip to content

Instantly share code, notes, and snippets.

@fbouchery
fbouchery / extract.php
Last active March 14, 2024 09:49
Extract phpstan baseline history count from GIT
<?php
$baselineFile = 'phpstan-baseline.neon';
$branch = 'origin/main';
echo "date;count\n";
foreach (explode("\n", `git log {$branch} --pretty="format:%H;%cI" --date-order --reverse {$baselineFile}`) as $line) {
[$hash, $date] = explode(';', $line);
preg_match_all('`^\s+count:\s+(\d+)`m', `git show $hash:{$baselineFile}`, $matches);
echo $date, ';', array_sum(array_map('intval', $matches[1])), "\n";
}
@1player
1player / bazarr.docker-compose.yml
Last active February 17, 2024 20:41
Poor man's media centre
# Bazarr downloads subtitles
version: "3.4"
services:
bazarr:
image: linuxserver/bazarr:1.0.5-development
container_name: bazarr
restart: unless-stopped
environment:
- TZ=Europe/London
@prologic
prologic / LearnGoIn5mins.md
Last active April 30, 2024 15:10
Learn Go in ~5mins
@barryosull
barryosull / index.php
Created February 28, 2020 10:32
PHPUnit Code Coverage Report of Web App
<?php
/**
How to run a code coverage report on a web page:
Simply put this code after the vendor require and before the rest of the calling logic.
(Assumes you have PHPUnit installed)
**/
require_once __DIR__ . "/../vendor/autoload.php";
# File: /etc/apt/apt.conf.d/docker-autoremove-suggests
# Since Docker users are looking for the smallest possible final images, the
# following emerges as a very common pattern:
# RUN apt-get update \
# && apt-get install -y <packages> \
# && <do some compilation work> \
# && apt-get purge -y --auto-remove <packages>
# By default, APT will actually _keep_ packages installed via Recommends or
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@wurin7i
wurin7i / damm_check_digit.php
Last active March 1, 2020 15:44
Damm validation & generation code in PHP.Damm algorithm is a check digit algorithm that detects all single-digit errors and all adjacent transposition errors.
<?php
/**
* The Damm check digit
* For more information cf. http://en.wikipedia.org/wiki/Damm_algorithm
* totally anti-symmetric quasigroup
*
* @author Wuri Nugrahadi <w.nugrahadi@gmail.com>
*/
if (! function_exists('taq'))
{
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.