Skip to content

Instantly share code, notes, and snippets.

View bendavies's full-sized avatar
🏠
Working from home

Ben Davies bendavies

🏠
Working from home
View GitHub Profile
@Ocramius
Ocramius / git-flow_vs_github-flow.md
Created October 7, 2022 08:38
Git-flow vs GitHub-flow

Git-flow vs GitHub-flow

What we want

A list of requirements:

  • stakeholders expect a list of provided features, every few days, in a human-friendly report
  • every change must have been reviewed, before being deployed
  • every change must have passed our automated checks, before being deployed
  • every change must have been verified by QA staff, before being deployed
@ciaranmcnulty
ciaranmcnulty / notes.md
Last active March 25, 2024 06:36
Notes on using Docker on ARM Macs (November 2021)

Docker for Mac

On M1 machines, Docker for Mac is running a lightweight linux ARM VM, then running containers within that, so containers are essentially running natively. Don't be fooled by the fact the UI or binary CLI tools (e.g. docker) might require Rosetta.

Within that VM is an emulation layer called QEmu. This can be used by docker to run Intel containers. This does not use Rosetta at all, and has a roughly 5-6X performance penalty. (If you just upgraded your CPU this may result in a similar performance to your old machine!)

Pulling and running with Docker

Many images in public registries are multi-architecture. For instance at the time of writing on Docker Hub the php:8.0-cli image has the following digests:

@thomas-seres
thomas-seres / JsonFilter.deprecated.php
Last active February 17, 2024 20:14
API Platform - JSON Filter
<?php
/**
*
* @author Thomas Sérès <thomas.seres@gmail.com>
*/
namespace App\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use ApiPlatform\Core\Exception\InvalidArgumentException;
@angeloskaltsikis
angeloskaltsikis / Dockerfile
Last active April 26, 2023 10:14 — forked from dmattia/terragrunt_light.js
A wrapper to make Terragrunt less verbose (both plan & apply supported). Also includes all the files required to efficiently run Terragrunt with Atlantis.
ARG atlantis_version=v0.15.0
FROM runatlantis/atlantis:${atlantis_version}
LABEL maintainer="Beat DevOps Team"
LABEL description="thebeat.co atlantis image used in IaC CI/CD!"
LABEL version="0.2"
# https://github.com/gruntwork-io/terragrunt/releases
ARG terragrunt_version=v0.25.1
@sivakov512
sivakov512 / ltree-example.sql
Last active November 11, 2022 16:35
Usign PostgreSQL Ltree extenstion
CREATE EXTENSION ltree;
CREATE TABLE test(
id serial primary key,
path ltree
);
INSERT INTO test (path) VALUES
('1'),
('1.1'),
('1.1.1'),
@lelegard
lelegard / purging-old-artifacts-with-github-api.md
Last active January 18, 2024 07:19
Purging old artifacts with GitHub Actions API

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@patricknelson
patricknelson / - Using Xdebug in Docker.md
Last active October 15, 2023 19:59
Using Xdebug in Docker (works with PhpStorm)

Using Xdebug in Docker

Getting setup and running with Xdebug in a docker container these days is now fairly simple and is composed of two main steps:

  1. Ensure you've got XDebug installed and enabled in your PHP docker image, for example:
    # Installing Xdebug with PHP 7.3 images:
    RUN pecl install xdebug \
      && docker-php-ext-enable xdebug
@xavismeh
xavismeh / symfony-messenger_sqs_installation.md
Last active June 13, 2019 17:57
Tutorial to use Amazon SQS with symfony/messenger component
  1. Install librairies/bundle:
$ composer require sroze/messenger-enqueue-transport enqueue/sqs
  1. Enable EnqueueAdapterBundle bundle:
// config/bundles.php
<?php
@dbu
dbu / CommandHelper.php
Created May 9, 2019 11:08
typed options and arguments for symfony console
abstract class CommandHelper
{
public static function getStringOption(InputInterface $input, string $name): ?string
{
$optionData = $input->getOption($name);
if (null !== $optionData && !\is_string($optionData)) {
throw new \InvalidArgumentException(sprintf('Invalid data provided for --%s', $name));
}
@HackingGate
HackingGate / restore_last_git_modified_time.sh
Last active May 13, 2024 12:59
Retrieve and set the last modification date of all files in a git repository. Solution for https://stackoverflow.com/a/55609950/4063462
#!/bin/sh -e
OS=${OS:-`uname`}
if [ "$OS" = 'Darwin' ]; then
get_touch_time() {
date -r ${unixtime} +'%Y%m%d%H%M.%S'
}
else
# default Linux