Skip to content

Instantly share code, notes, and snippets.

View markomilivojevic's full-sized avatar
🥥

Marko Milivojevic markomilivojevic

🥥
View GitHub Profile
@markomilivojevic
markomilivojevic / array_rand_segmented.php
Last active May 9, 2019 09:42
PHP array random elements per segments
<?php
/**
* Get random elements by segments
*
* If you pass 100 elements with limit 5, it will return 5 elements in following order:
*
* First: rand between 0 - 20
* Second: rand between 20 - 40
* Third: rand between 40 - 60
@markomilivojevic
markomilivojevic / common_linux_commands.txt
Last active April 11, 2019 14:08
Common Linux Commands
ls
ls *{pattern}* "list files like *pattern*"
ls -la
ll
tail -f {filename}
tail {filename}
head {filename}
cat {filename}
grep {what} {filename} "occurence in file"
grep {what} {filename} -A 20 -B 20 "-A lines after, -B lines before"
SELECT
table_schema AS `Database`,
table_name AS `Table`,
ROUND(((data_length + index_length) / 1024 / 1024 / 1024),
2) `Size in GB`
FROM
information_schema.TABLES
WHERE
ROUND(((data_length + index_length) / 1024 / 1024 / 1024), 2) > 1
ORDER BY (data_length + index_length) DESC;