Skip to content

Instantly share code, notes, and snippets.

@DDiimmkkaass
DDiimmkkaass / Git archive one latest commit
Last active Sep 11, 2019
Git archive one latest commit
View Git archive one latest commit
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)
View Laravel + Gmail
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 AbstractRepository
<?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 Work with ssl keys
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 ubuntu_backup.txt
бекап
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
@DDiimmkkaass
DDiimmkkaass / laravel_years_and_month_grouping_collection.php
Created May 12, 2016
Laravel: Групована по роках і місяцях колекція для виводу новин
View laravel_years_and_month_grouping_collection.php
$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 preprocessor_fun.h
// 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,