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 <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# 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 <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
PHPCS_BIN=/usr/bin/phpcs
PHPCS_CODING_STANDARD=PEAR
@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

@matthias-chlechowitz
matthias-chlechowitz / README.md
Created August 2, 2019 09:45 — forked from sapessi/README.md
Continuous deployment of React websites to Amazon S3

Continuous deployment of React websites to Amazon S3

This sample includes a continuous deployment pipiline for websites built with React. We use AWS CodePipeline, CodeBuild, and SAM to deploy the application. To deploy the application to S3 using SAM we use a custom CloudFormation resource.

Files included

  • buildspec.yml: YAML configuration for CodeBuild, this file should be in the root of your code repository
  • configure.js: Script executed in the build step to generate a config.json file for the application, this is used to include values exported by other CloudFormation stacks (separate services of the same application).
  • index.js: Custom CloudFormation resource that publishes the website to an S3 bucket. As you can see from the buildspec and SAM template, this function is located in a s3-deployment-custom-resource sub-folder of the repo
  • app-sam.yaml: Serverless Application model YAML file. This configures the S3 bucket and the cu