Skip to content

Instantly share code, notes, and snippets.

View tinker1987's full-sized avatar

Dmytro Paiareli tinker1987

View GitHub Profile
@tinker1987
tinker1987 / parse_dotenv.bash
Last active November 25, 2019 07:51 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# 1. Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs -d '\n') MYCOMMAND
# … or ...
# 2. Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs -d '\n')
# 3. Avoid existent vars overriding
source <(grep -v '^#' .env | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
# 4.
@tinker1987
tinker1987 / Dockerfile
Last active September 25, 2018 21:16
PHP7.2-cli with pre-installed packages
################################################################################
# Base image
################################################################################
FROM php:7.2
################################################################################
# Build instructions
################################################################################
@tinker1987
tinker1987 / Dockerfile
Created February 21, 2018 10:20
PHP 7.0 with preinstalled packages: intl, mcrypt, iconv, curl, mbstring, bcmath, bz2, mysqli, pdo, pdo_mysql, zip, xml, json, xsl, gd, redis, xdebug, memcached, geoip and composer
FROM php:7.0-fpm-alpine
# =================================================================================================
# Install packages
RUN apk update
RUN apk add --no-cache git supervisor curl curl-dev autoconf libjpeg-turbo-dev freetype-dev libpng-dev libmcrypt-dev libcurl libbz2 bzip2-dev geoip openssl-dev icu icu-dev icu-libs zlib-dev memcached libmemcached-dev alpine-sdk build-base gcc wget cyrus-sasl-dev geoip-dev libxslt-dev libxml2-dev
@tinker1987
tinker1987 / .vimrc
Created February 19, 2018 06:57
Very nice vim config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@tinker1987
tinker1987 / JavaScript.sublime-build
Created November 22, 2017 16:08 — forked from corbanb/JavaScript.sublime-build
Sublime Text - Tools > Build System > New Build System
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
@tinker1987
tinker1987 / nginx-tuning.md
Created September 26, 2017 12:21 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@tinker1987
tinker1987 / FixtureAwareTestCaseTrait.php
Last active September 1, 2017 14:00
Allow to load fixtures for integration tests
<?php
declare(strict_types=1);
namespace Tests;
use Doctrine\Common\DataFixtures\{
Executor\ORMExecutor, FixtureInterface, Purger\ORMPurger, SharedFixtureInterface
};
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
@tinker1987
tinker1987 / 00_OSX_Docker_Machine_Setup.md
Created June 26, 2017 09:25 — forked from bitjockey42/00_OSX_Docker_Machine_Setup.md
Use native virtualization on OS X docker with xhyve

What this?

So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.

No more dealing with virtualbox shenanigans!

In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.

Requirements

@tinker1987
tinker1987 / tail-color.sh
Last active September 11, 2017 08:36 — forked from kartikshah/tail-color.sh
Color output of linux tail command
tail -100f var/logs/dev.log | awk '
/INFO/ {print "\033[32m" $0 "\033[39m"}
/ERROR|Exception/ {print "\033[31m" $0 "\033[39m"}
/DEBUG/ {print "\033[33m" $0 "\033[39m"}
'
@tinker1987
tinker1987 / mysql_import_progress
Created April 6, 2017 09:54
It will show you a progress bar during the import progress based on the IO throughput.
`pv -i 1 -p -t -e /path/to/sql/dump | mysql -u USERNAME -p DATABASE_NAME`