Skip to content

Instantly share code, notes, and snippets.

View matthias-chlechowitz's full-sized avatar

Matthias Chlechowitz matthias-chlechowitz

View GitHub Profile
@matthias-chlechowitz
matthias-chlechowitz / parameter_removal.php
Created February 6, 2015 16:40
Remove all parameter definitions from container definitions (read: *.xml) and replace the parameters with the actual class names
<?php
use Symfony\Component\Finder\Finder;
require_once('../app/autoload.php');
$finder = new Finder();
$finder->files()->in(__DIR__)->name('*.xml');
// run through all found files
foreach ($finder as $file) {
#!/bin/bash
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# Or execute `ln -sf ./bin/git/pre-push .git/hooks/pre-push`
@matthias-chlechowitz
matthias-chlechowitz / gist:a96cceea7a3e9ff8ebd9
Created September 3, 2015 13:30
generate random string
LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w ${1:-32} | head -n 1
@matthias-chlechowitz
matthias-chlechowitz / sh
Created November 6, 2015 09:17
pre-commit including phpcs
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <[email protected]>
# @author Sebastian Kaspari <[email protected]>
#
# see the README
PHPCS_BIN=/usr/bin/phpcs
PHPCS_CODING_STANDARD=PEAR
@matthias-chlechowitz
matthias-chlechowitz / pre-commit
Last active September 20, 2017 14:22
PreCommit-Hook
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <[email protected]>
# @author Sebastian Kaspari <[email protected]>
#
# see the README
PHPCS_BIN=/usr/bin/phpcs
PHPCS_CODING_STANDARD=PEAR
@matthias-chlechowitz
matthias-chlechowitz / gist:8b1d2be2923af248dd0f2e2cb201437c
Created September 14, 2016 16:02
remove fragment from file path in nginx location block
call:
$domain/sym_assets/**/*.jpg
desired result:
$root_dir/path/on/server/**/*.jpg
$root is different than place on server
location ~ /sym_assets {
rewrite ^/sym_assets(/.*)$ $1 last;
@matthias-chlechowitz
matthias-chlechowitz / get-instance.sh
Created May 22, 2018 09:24 — forked from mince27/get-instance.sh
AWS Lightsail get instance info
# Full description of instance
aws lightsail get-instance --instance-name 'LightsailDemo'
# Return only the IP
aws lightsail get-instance --instance-name 'LightsailDemo' --query 'instance.privateIpAddress' --output text
# Connect
ssh -i demo.key ec2-user@<IP_ADDRESS>
@matthias-chlechowitz
matthias-chlechowitz / php-pools.md
Created October 30, 2018 10:06 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@matthias-chlechowitz
matthias-chlechowitz / nginx.conf
Created April 29, 2019 13:48 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@matthias-chlechowitz
matthias-chlechowitz / iterm2-solarized.md
Created July 23, 2019 11:31 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k