Skip to content

Instantly share code, notes, and snippets.

DDiimmkkaass / Git archive one latest commit
Last active September 11, 2019 11:43
Git archive one latest commit
View Git archive one latest commit
one commit - 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 $(git diff old-commit-id new-commit-id --name-only)
diff between commits (windows/unix) - git archive --format=zip HEAD $(git diff old-commit-id new-commit-id --name-only)
View Laravel + Gmail
need 2 factor authorization
View AbstractRepository
* Created by Newway,
* User: ddiimmkkaass,
* 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 / laravel_years_and_month_grouping_collection.php
Created May 12, 2016 07:43
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,