Skip to content

Instantly share code, notes, and snippets.

View mpdude's full-sized avatar
💭
Coding

Matthias Pigulla mpdude

💭
Coding
View GitHub Profile
@mpdude
mpdude / fix-php-cs.yml
Created May 20, 2022 08:57
Run PHP-CS-Fixer on PRs and commit/push back changes
# .github/workflows/fix-php-cs.yml
on:
pull_request:
name: Coding Standards
jobs:
open-pr-for-cs-violations:
name: PHP-CS-Fixer
runs-on: ubuntu-20.04
@mpdude
mpdude / README.md
Created January 18, 2022 20:52
Use `jq` to tweak `composer.json` requirements

Change Symfony requirements in composer.json

This took me two hours on stackoverflow.com, so I'm going to document it to future me:

In the composer.json require section, for all packages starting with symfony/, but not for symfony/monolog-bundle, change the required version to the value of the $VERSION environment variable.

Write out the updated composer.json file in a way that works _without sponge`, which is not installed on GitHub Action runners by default.

-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYLvsoRYJKwYBBAHaRw8BAQdAfGlCQI9xzi6s/JSfkcE19grdeW3Xf/hIUv1T
Czfgo+G0I01hdHRoaWFzIFBpZ3VsbGEgPG1wQHdlYmZhY3RvcnkuZGU+iI4EExYK
ADYCGwEECwkIBwQVCgkIBRYCAwEAAh4BAheAFiEEhU82pmfobc+YBhNGhc7z7F2f
JHwFAmC/A1UACgkQhc7z7F2fJHxfywD+KimyGRa5Fv4NyS+eXRE+5xIy0q+SeMkQ
djU36a1jVfIA/RNkseAmUe3BB9xavrBklwxetynXtjUZsIzmwaxyFyUAuDMEYLvt
jhYJKwYBBAHaRw8BAQdAPeAqSij5tu/5ol3zmeFCU98g5U3LCAqPIfVsstH7g6aI
7wQYFgoAIAIbAhYhBIVPNqZn6G3PmAYTRoXO8+xdnyR8BQJgvwNiAIF2IAQZFgoA
HRYhBIW5u5oK9SUa2Pft5wdiXbCBXWyhBQJgu+2OAAoJEAdiXbCBXWyh43cBAKyp
@mpdude
mpdude / ssh-deploy-key-wrapper.sh
Last active June 26, 2022 05:20
Wrapper around `ssh` to pick the right one from several GitHub deploy keys
#!/bin/bash
# The last argument is the command to be executed on the remote end, which is something
# like "git-upload-pack 'webfactory/ssh-agent.git'". We need the repo path only, so we
# loop over this last argument to get the last part of if.
for last in ${!#}; do :; done
# Don't use "exec" to run "ssh" below; then the trap won't work.
key_file=$(mktemp -u)
trap "rm -f $key_file" EXIT
@mpdude
mpdude / projekt-img.sh
Last active May 12, 2020 13:29 — forked from scottsb/casesafe.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
#!/bin/bash -e
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/Projekte}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.Projekte.sparsebundle}"
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-Projekte}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-200g}"
@mpdude
mpdude / fix-cs-php.yml
Last active August 27, 2024 07:31
GitHub Actions workflow to run PHP-CS-Fixer and push changes back to the branch
# Update this by running
# curl https://gist.github.com/mpdude/ca93a185bcbf56eb7e341632ad4f8263/raw/fix-cs-php.yml > .github/workflows/fix-cs-php.yml
on:
push:
branches:
- master
pull_request:
name: Coding Standards
@mpdude
mpdude / AWS-permissions.json
Created January 15, 2020 21:42
Build a Docker Image on GitHub Actions and push to AWS ECR
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:CompleteLayerUpload",
@mpdude
mpdude / build.yml
Last active January 15, 2020 16:57
Build Docker image and push it to GPR
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
@mpdude
mpdude / whiteboardCleaner.md
Created December 22, 2019 13:39 — forked from Ocramius/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Keybase proof

I hereby claim:

  • I am mpdude on github.
  • I am mpdude (https://keybase.io/mpdude) on keybase.
  • I have a public key ASAdscxl5DfSh-Nrq8J95UjzAg6e7bIgoSGKTdOzeB_8VAo

To claim this, I am signing this object: