This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# See https://gist.github.com/wryfi/3902757 | |
# Crude CPU usage thing for container(s). | |
import multiprocessing, os, re, sys, time | |
import getopt | |
cgroup_dir = '/sys/fs/cgroup/lxc/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema, | |
table_name, | |
data_type, | |
( CASE data_type | |
WHEN 'tinyint' THEN 255 | |
WHEN 'smallint' THEN 65535 | |
WHEN 'mediumint' THEN 16777215 | |
WHEN 'int' THEN 4294967295 | |
WHEN 'bigint' THEN 18446744073709551615 | |
end >> IF(Locate('unsigned', column_type) > 0, 0, 1) ) AS MAX_VALUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
INSTRUCTIONS: Use at your own risk. Backup your database before continuing. | |
1. Copy code to a file in the root of your website. | |
2. Change YOUR_SITE_ROOT to a value that makes sense. | |
3. Execute by visiting the page. Verify before/after results. | |
4. Change MAKE_CHANGES_TO_SITE to true and execute it again. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
INSTRUCTIONS: | |
Use at your own risk. Backup your database before continuing. | |
1. Copy code to a file in the root of your website. | |
2. Change YOUR_SITE_ROOT to a value that makes sense. | |
3. Execute by visiting the page. Verify before/after results. | |
4. Change MAKE_CHANGES_TO_SITE to true and execute it again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Original effort: https://gist.github.com/Daniel15/5991193 */ | |
function last($arr) | |
{ | |
eval('list(' . str_repeat(',', count($arr) - 1) . '$result) = $arr;'); | |
return $result; | |
} | |