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 / symfony.xml
Created September 6, 2018 20:30
Symfony code style settings for PhpStorm
<code_scheme name="Project" version="173">
<option name="RIGHT_MARGIN" value="150" />
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
@mpdude
mpdude / my-workflow.yml
Last active August 25, 2023 13:00
Setup a SSH deploy key so that workflow steps can fetch dependencies from private GitHub repos
# .github/workflows/my-workflow.yml
# ... other config here
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Setup SSH Keys and known_hosts
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
@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.

@mpdude
mpdude / fix-cs-php.yml
Last active October 27, 2022 06:55
GitHub Actions workflow to open PRs for php-cs-fixer changes
# Update this by running
# curl https://gist.githubusercontent.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 / 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 / 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 / .profile
Last active March 31, 2022 15:20
~/.profile für OS X
# ~/.profile wird bei jedem Shell-Start ausgeführt
# (In der Bash: NUR ausgeführt, wenn ~/.bash_profile nicht existiert)
# Autocompletion z. B. auch für SSH-Hostnamen
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Shortcut für: Bei einem SSH-Login auf einer anderen Maschine, den eigenen
# SSH-Schlüssel mitnehmen (z.B. damit man dort dann ein per SSH ausgechecktes
-----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 / README.md
Last active May 2, 2021 02:42
`phpinfo` output for various PHP versions shipped with GitHub Actions
@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}"