Cheat Sheet
Docker
Changer la plage d’adresse par défaut des réseaux Docker
Fichier /etc/docker/daemon.json
{
"default-address-pools": [
{
"scope": "local",
"base": "172.80.0.0/16",
"size": 24
},
{
"scope": "global",
"base": "172.90.0.0/16",
"size": 24
}
]
}
Lister la taille des fichiers/dossiers
du -ach . --max-depth 1
RSYNC
rsync -chavzP --stats user@domain.com:/source/path /destination/path/
-c, --checksum
skip based on checksum, not mod-time & size-h, --human-readable
output numbers in a human-readable format-a, --archive
archive mode; equals-rlptgoD
(no -H,-A,-X)-r, --recursive
recurse into directories-l, --links
copy symlinks as symlinks-p, --perms
preserve permissions-t, --times
preserve modification times-g, --group
preserve group-o, --owner
preserve owner (super-user only)-D
same as –devices –specials
-v, --verbose
increase verbosity-z, --compress
compress file data during the transfer-P
same as –partial –progress--partial
keep partially transferred files
GIT
Supprimer une branche distante
git push origin :my-branch
ou git push origin --delete my-branch
Magento 2
Loader un attribut produit et récupérer sa valeur pour un produit
<?php
// use Magento\Catalog\Model\ResourceModel\Eav\AttributeFactory;
// use Magento\Catalog\Model\Product;
$sizeAttribute = $this->attributeFactory->create()
->loadByCode(Product::ENTITY, 'size');
$value = $sizeAttribute->getFrontend()->getValue($product);
PHP
PHP memory_get_usage convert in kb, mb, …
<?php
function convert($size) {
$unit = array('b','kb','mb','gb','tb','pb');
return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i];
}