Skip to content

Instantly share code, notes, and snippets.

View willboudle's full-sized avatar

Will Boudle willboudle

View GitHub Profile

Found here by Stephan Farestam

Here is a bash-only YAML parser that leverages sed and awk to parse simple yaml files:

function parse_yaml {
   local prefix=$2
   local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
   sed -ne "s|^\($s\):|\1|" \
        -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \

-e "s|^($s)($w)$s:$s(.*)$s$|\1$fs\2$fs\3|p" $1 |

@willboudle
willboudle / unbuffered_shell_example.php
Created May 30, 2018 02:48 — forked from cmtickle/unbuffered_shell_example.php
Use unbuffered SQL queries with Magento to reduce memory usage on large data sets.
<?php
require_once 'abstract.php';
class Cmtickle_Demo_Shell_Tool extends Mage_Shell_Abstract
{
private $_readConnection = null;
protected function _getReadConnection()
{
@willboudle
willboudle / 0_reuse_code.js
Last active August 29, 2015 14:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@willboudle
willboudle / Mage::cleanup.php
Last active February 3, 2017 22:34 — forked from mschultheiss83/Mage::cleanup.php
Magento what needs to be cleaned in database
<?php
/***************************************************
* Magento Log File Contents Monitor. GNU/GPL
* landau@fiascolabs.com
* provided without warranty or support
***************************************************/
/***********************
* Scan Magento local.xml file for connection information
// ## Note: If not in a module sql setup use the following 2 lines
require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
// ## Note: Setup the new category attribute
$installer = new Mage_Sales_Model_Mysql4_Setup;
$installer->startSetup();
$installer->addAttribute('catalog_category', 'additional_css', array(
'type' => 'text',
'backend' => '',
'frontend' => '',
@willboudle
willboudle / gist:2491587
Created April 25, 2012 17:42 — forked from aschroder/gist:2469319
Magento REST API PHP test harness (admin and customer)
<?php
/**
* Copyright Magento 2012
* Example of products list retrieve using Customer account via Magento
REST API. OAuth authorization is used
*/
$callbackUrl = "http://yourhost/oauth_customer.php";
$temporaryCredentialsRequestUrl =
"http://magentohost/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);