View preprocessor_fun.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
View laravel_years_and_month_grouping_collection.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$news = News::published()->active()->get()->groupBy(function ($date) { | |
return Carbon::parse($date->published_at)->formatLocalized('%Y'); | |
}); | |
$grouped = $news->map(function ($date) { | |
return ($date->groupBy(function ($item) { | |
return Carbon::parse($item->published_at)->formatLocalized('%B'); | |
})); | |
}); |
View ubuntu_backup.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
бекап | |
mkdir /mnt/backup | |
mount /dev/sdb1 -- какая то флешка или винт | |
dd if=/dev/sda bs=8M conv=sync,noerror | gzip -c > /mnt/backup/sda.img | |
відновлення | |
gunzip -c /mnt/backup/sda.img | dd of=/dev/sda conv=sync,noerror bs=8M |
View AbstractRepository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by Newway, info@newway.com.ua | |
* User: ddiimmkkaass, ddiimmkkaass@gmail.com | |
* Date: 09.02.17 | |
* Time: 14:05 | |
*/ | |
namespace App\Services\Aggregator\v1\Repositories; |
View Laravel + Gmail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://myaccount.google.com/lesssecureapps?pli=1 | |
need 2 factor authorization | |
https://myaccount.google.com/apppasswords | |
MAIL_DRIVER=smtp | |
MAIL_HOST=smtp.gmail.com | |
MAIL_PORT=587 | |
MAIL_FROM_ADDRESS=support@support.com | |
MAIL_FROM_NAME=SUPPORT | |
MAIL_USERNAME= |
View Work with ssl keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl genrsa -out partner.ppk 1024 | |
openssl req -new -key partner.ppk -out partner.req | |
openssl x509 -req -days 730 -in partner.req -signkey partner.ppk -out partner.cer | |
Для конвертации приватного ключа ppk в pfx: | |
openssl pkcs12 -export -in partner.cer -inkey partner.ppk -certfile partner.cer -nodes -out partner.pfx | |
Extract Private key |
View Git archive one latest commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
one commit - zip archive.zip $(git diff-tree --no-commit-id --name-only -r commit-id) | |
diff between commits - git diff old-commit-id new-commit-id --name-only | xargs tar -zcvf update.tar.gz | |
diff between commits - zip archive.zip $(git diff old-commit-id new-commit-id --name-only) | |
diff between commits (windows/unix) - git archive --format=zip --output=files.zip HEAD $(git diff old-commit-id new-commit-id --name-only) |