Skip to content

Instantly share code, notes, and snippets.

Matthias Chlechowitz matthias-chlechowitz

View GitHub Profile
@matthias-chlechowitz
matthias-chlechowitz / README.md
Created Aug 2, 2019 — forked from sapessi/README.md
Continuous deployment of React websites to Amazon S3
View README.md

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
@matthias-chlechowitz
matthias-chlechowitz / iterm2-solarized.md
Created Jul 23, 2019 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@matthias-chlechowitz
matthias-chlechowitz / nginx.conf
Created Apr 29, 2019 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
View nginx.conf
#
# 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 / php-pools.md
Created Oct 30, 2018 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)
View php-pools.md

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 / get-instance.sh
Created May 22, 2018 — forked from mince27/get-instance.sh
AWS Lightsail get instance info
View get-instance.sh
# 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 / gist:8b1d2be2923af248dd0f2e2cb201437c
Created Sep 14, 2016
remove fragment from file path in nginx location block
View gist:8b1d2be2923af248dd0f2e2cb201437c
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;
View pre-commit
#!/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 / sh
Created Nov 6, 2015
pre-commit including phpcs
View sh
#!/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
View gist:a96cceea7a3e9ff8ebd9
LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | fold -w ${1:-32} | head -n 1
View gist:855ea370e2365bcd6cbf
#!/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`
You can’t perform that action at this time.