2018 m. sausio 17 d., trečiadienis

inode detect directories

du --inodes -S | sort -rh | sed -n \
        '1,50{/^.\{71\}/s/^\(.\{30\}\).*\(.\{37\}\)$/\1...\2/;p}'
arba tiesiog suskaiciuoti failus aplankuose:
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr

2018 m. sausio 8 d., pirmadienis

Detecting the HTTP method

$method = $_SERVER['REQUEST_METHOD']
if ($method == 'POST') {
    // Method is POST
} elseif ($method == 'GET') {
    // Method is GET
} elseif ($method == 'PUT') {
    // Method is PUT
} elseif ($method == 'DELETE') {
    // Method is DELETE
} else {
    // Method unknown
}
Way to use PUT data from PHP:
$method = $_SERVER['REQUEST_METHOD'];
if ('PUT' === $method) {
    parse_str(file_get_contents('php://input'), $_PUT);
    var_dump($_PUT); //$_PUT contains put fields 
}