Skip to content

Instantly share code, notes, and snippets.

Marko Milivojevic duchalovac

Block or report user

Report or block duchalovac

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@duchalovac
duchalovac / array_rand_segmented.php
Last active May 9, 2019
PHP array random elements per segments
View array_rand_segmented.php
<?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
View common_linux_commands.txt
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"
View Database Usage
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;
You can’t perform that action at this time.