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
<script type="text/javascript"> | |
jQuery.fn.doCleanInputs = function () { | |
jQuery(this).each(function() { | |
var default_value = this.value; | |
jQuery(this).focus(function(){ | |
if(this.value == default_value) {this.value = '';} | |
}); | |
jQuery(this).blur(function(){ | |
if(this.value == '') {this.value = default_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
SELECT DISTINCT value FROM catalog_category_entity_varchar WHERR attribute_id = 1906 | |
ORDER BY value DESC |
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 as `Database`, | |
table_name AS `Table`, | |
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` | |
FROM information_schema.TABLES | |
ORDER BY (data_length + index_length) DESC; |
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 "Data Base Name", | |
sum( data_length + index_length ) / 1024 / | |
1024 "Data Base Size in MB", | |
sum( data_free )/ 1024 / 1024 "Free Space in MB" | |
FROM information_schema.TABLES | |
GROUP BY table_schema ; |
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
set @a=null,@c=null,@b=concat("show tables where",ifnull(concat(" `Tables_in_",database(),"` like '",@c,"' and"),'')," (@a:=concat_ws(',',@a,`Tables_in_",database(),"`))"); | |
Prepare `bd` from @b; | |
EXECUTE `bd`; | |
DEALLOCATE PREPARE `bd`; | |
set @a:=concat('optimize table ',@a); | |
PREPARE `sql` FROM @a; | |
EXECUTE `sql`; | |
DEALLOCATE PREPARE `sql`; |
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 COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'; | |
show global status like '%Threads_connected%'; |
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
show global status like 'open%'; |
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
#!/bin/bash | |
# | |
# Optimize all jpg and png files in the cwd | |
# Run it again to optimize new files since the last run | |
# | |
# Example: | |
# echo "optimize_media.sh > /tmp/optimize.log" | sudo -u www-data bash -s | |
# | |
# Colin Mollenhour 2016 |
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
#!/bin/bash | |
DBNAME=mwe | |
SNAPSHOT_DAYS=7 | |
ARCHIVE_DAYS=60 | |
mysqldump=/usr/bin/mysqldump | |
gzip=/bin/gzip | |
function error() { | |
echo $1 >> $logfile.tmp |
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
#!/bin/bash | |
cd /media/dumps | |
name=$(date +%b-%d) | |
year=$(date +%Y) | |
[ -d $year ] || mkdir $year || { echo "Could not create directory '$year'"; exit 1; } | |
mongodump --db t3_mage --out $name &> mongodump.log | |
if [ $? ]; then | |
tar -czf snapshots/$year/$name.tgz $name | |
if [ $(($(date +%d | sed 's/^0*//') % 10)) == 0 ]; then |
OlderNewer