Skip to content

Instantly share code, notes, and snippets.

@androzd
androzd / tunelling to localhost
Last active October 20, 2016 08:26
NGINX server to localhost tunelling
Это нужно чтобы ловить webhook от различных сервисов на локаль, либо чтобы показать сайт заказчику.
Что нужно: Сервер со статическим IP с настроенным NGINX, и localhost с установленным ssh
Что получится в итоге: при открытии some.site.ru будет открыт дефолтный сервер на localhost
@androzd
androzd / mysql-dump
Last active August 8, 2016 08:58
Mysql Dump Rotation
/path/to/dumps/*.sql {
daily
rotate 14
missingok
create 660 andrey andrey
compress
sharedscripts
postrotate
USER="dbuser"
PASSWORD="dbpassword"
@androzd
androzd / dnsmasq
Last active September 25, 2016 09:43
Настройка dnsmasq
@androzd
androzd / crazy cd :)
Created December 21, 2015 07:49
If you have long path and need replace dir you can do this to change parent dir
# /home/from/Pictures/1/2/asdasd/cdcz/asdqwe/asdfasgfas/vfhbgh/vfahdfg/dsfahgasg/asdh725
cd `pwd | replace from to`
# /home/to/Pictures/1/2/asdasd/cdcz/asdqwe/asdfasgfas/vfhbgh/vfahdfg/dsfahgasg/asdh725
#if directory structure is identical
@androzd
androzd / pre-commit
Last active September 24, 2015 18:56
git pre-commit hook for symfony2. Runs phpunit test, before commit.
#!/usr/bin/php
<?php
echo PHP_EOL."\033[43mStarting unit tests\033[0m".PHP_EOL;
exec('phpunit -c app', $output, $returnCode);
if ($returnCode !== 0)
{
while (($minimalTestSummary = array_pop($output)) !== null)
@androzd
androzd / auto.conf
Last active July 14, 2017 10:04
nginx automatic configuration for laravel, kohana, symfony projects
server {
listen 80;
server_name "~^((?<subdomain>.+)\.)?(?<domain>.+)\.loc$";
set $projects_dir /var/www;
set $project_dir $projects_dir/$domain;
if (-d $projects_dir/$subdomain.$domain) {
set $project_dir $projects_dir/$subdomain.$domain;
}
set $index index.php;
set $root_dir $project_dir/public;