Skip to content

Instantly share code, notes, and snippets.

@kalenjordan
kalenjordan / gist:6731541
Last active December 24, 2015 02:38
Unique 404's
grep "HTTP\/...\" 404" nginx-access.log | awk '{ print $16}' | sort | uniq
@kalenjordan
kalenjordan / Batched Iterator for Magento collections
Last active May 9, 2022 12:25
Batched iterator for Magento collections
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
Mage::getSingleton('stcore/resource_iterator_batched')->walk(
$collection,
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
self::BATCH_SIZE
);
public function batchIndividual($model)
# Create the directory
cd ~ && mkdir bin
cd ~/bin
# Install composer
curl -s https://getcomposer.org/installer | php
# Clone the repo
git clone [email protected]:kjordan/magerun.git magerun
@kalenjordan
kalenjordan / gist:3901671
Created October 16, 2012 20:11
Find and mass replace, Find and delete
# Delete backup files
find . -name "*.bak" -exec rm {} \;
# Find and mass replace. It creates .bak files, but without the .bak this doesn't work in OSX
find . -exec sed -i.bak s/Find/Replace/g {} \;
# find and replace
ack -l 'Find' | xargs perl -pi -E 's/Find/Replace/g'