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 / 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

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 / 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"}
'