Skip to content

Instantly share code, notes, and snippets.

Aaron Bonner ajbonner

Block or report user

Report or block ajbonner

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
ajbonner /
Last active Aug 2, 2017
PHP-FPM Status from CLI
sudo -u www-data \
SCRIPT_NAME=/status \
cgi-fcgi -bind -connect /var/run/php/php7.0-fpm.sock
ajbonner /
Last active Aug 7, 2017
Rename old git tags and copy annotations
for tag in $(git tag | grep '^2017'); do
git tag -a $(echo $tag | sed 's/^2017/17/') $tag -m "$(git tag -n $tag | sed -E 's/2017\.[0-9]{2}\.[0-9]{2}\.[0-9]{2}\s*//')"
git tag -d $tag
git push origin :refs/tags/$tag
ajbonner /
Created Apr 11, 2017
Strace all running php-fpm processes to file with timestamps and pid
sudo strace -f -tt -o /tmp/php.trace -s1024 -p `pgrep -f php-fpm | tr '\n' ','`
# see
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
ajbonner / ImageController.php
Last active Jul 8, 2016
Fix tiresome headers already sent bug in Magento 1.x
View ImageController.php
* Generate image thumbnail on the fly
public function thumbnailAction()
$file = $this->getRequest()->getParam('file');
$file = Mage::helper('cms/wysiwyg_images')->idDecode($file);
$thumb = $this->getStorage()->resizeOnTheFly($file);
if ($thumb !== false) {
ajbonner / event_dispatch_check.php
Last active Feb 5, 2016
Quick and dirty way to test if an observer responds to a given event in Magento 1 using MageTest
View event_dispatch_check.php
class SomeTestTest extends MageTest_PHPUnit_Framework_TestCase
* @param string $observerName e.g. mymodulens_mymodule_does_something_on_order_place
* @param string $eventName e.g. a dispatched event e.g. sales_order_place_after
* @param string $area e.g. global/frontend/admin/adminhtml
public function assertObserverReceivesEvent($observerName, $eventName, $area)
ajbonner / gist:e5eb20d253c2695912fa
Created Jul 8, 2015
Mac OSX Vagrant /etc/export for NFS
View gist:e5eb20d253c2695912fa
"/Users/aaron/Sites" -alldirs -mapall=501:20
ajbonner / filter_rename
Last active Aug 29, 2015
Mass Rename Files in a Dir Using Sed Expression
View filter_rename
#!/usr/bin/env bash
find . -name '*.gz' -print | while read SRC_FILE; do
DEST_FILE=$(echo $SRC_FILE | sed 's/_2014.*.sql.gz/.sql.gz/')
#!/usr/bin/env bash
echo '/tmp/core-%e.%p' > /proc/sys/kernel/core_pattern
echo 0 > /proc/sys/kernel/core_uses_pid
ulimit -c unlimited
ajbonner / intervention_watermark.php
Created Feb 6, 2014
Intervention Watermarking with Cache
View intervention_watermark.php
$filestore = new \Illuminate\Cache\FileStore(
new \Illuminate\Filesystem\Filesystem(),
$repository = new \Illuminate\Cache\Repository($filestore);
$cache = new \Intervention\Image\ImageCache($repository);
$watermark = $cache->make($watermarkFile)->get(0, true);
You can’t perform that action at this time.