MacBook Air (MBA) Mid 2012
SELECT count(*) tables, | |
concat(round(sum(table_rows)/1000000,2),'M') rows, | |
concat(round(sum(data_length)/(1024*1024*1024),2),'G') data, | |
concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx, | |
concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size, | |
round(sum(index_length)/sum(data_length),2) idxfrac | |
FROM information_schema.TABLES | |
WHERE table_schema = 'database-name' | |
ORDER BY data_length+index_length DESC LIMIT 10; |
#!/usr/bin/env bash | |
set -eu | |
declare -a file_patterns=('app/code/core' 'app/Mage.php$' '^index.php$') | |
exit_status=0 | |
while read x file; do | |
for file_pattern in ${file_patterns[@]}; do | |
if [[ $file =~ $file_pattern ]]; then |
ffmpeg -r 1 -t 1 -vframes 1 -i input-file.mp4 output-file.png |
<?php | |
require_once 'abstract.php'; | |
class Mage_Shell_Pricerules extends Mage_Shell_Abstract | |
{ | |
public function run() | |
{ | |
ini_set('memory_limit', '1024M'); | |
$this->db = Mage::getSingleton('core/resource')->getConnection('core_read'); |
After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.
Mage_Sales_Model_Abstract::_afterSave
must be removed and replaced with afterCommitCallback
. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.
Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory()
to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success
.
#!/bin/bash | |
# | |
# Copyright Colin Mollenhour 2014 | |
dir=/root/deadlocks | |
[ -d $dir ] || mkdir -p $dir | |
cd $dir || { echo "Could not cd to $dir"; exit 1; } | |
mysql -be 'show engine innodb status;' \ | |
| sed 's/\\n/\n/g' \ |
The first kata is the classic BowlingGame Kata from Uncle Bob.
Write a class named
Game
that has two methods
roll(pins : int)
is called each time the player rolls a ball. The argument is the number of pins knocked down.score()
: int is called only at the very end of the game. It returns the total score for that game.
Here is the original PowerPoint from Uncle Bob with the instructions including the solution steps. The PPT file also includes the rules for the scoring of a bowling game.
#!/bin/sh | |
# script for optimizing images in a directory (recursive) | |
# pngcrush & jpegtran settings from: | |
# http://developer.yahoo.com/performance/rules.html#opt_images | |
# pngcrush | |
for png in `find $1 -iname "*.png"`; do | |
echo "crushing $png ..." | |
pngcrush -rem alla -reduce -brute "$png" temp.png |
#!/usr/bin/php | |
<?php | |
/** | |
* .git/hooks/pre-commit | |
* | |
* This pre-commit hooks will check for PHP error (lint), and make sure the code | |
* is PSR compliant. | |
* | |
* Dependecy: PHP-CS-Fixer (https://github.com/fabpot/PHP-CS-Fixer) | |
* |