Skip to content

Instantly share code, notes, and snippets.

View dgitman's full-sized avatar

David Gitman dgitman

View GitHub Profile
<?php
require_once 'app/Mage.php';
Mage::app();
Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID);
$products = Mage::getModel('catalog/product')->getCollection();
//->addAttributeToFilter('entity_id', array('gt' => 14000));
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
aws rds reset-db-parameter-group --db-parameter-group-name=etl --reset-all-parameters
aws rds modify-db-parameter-group --db-parameter-group-name=etl \
--parameters="ParameterName=character_set_server, ParameterValue=utf8, ApplyMethod=immediate" \
--parameters="ParameterName=collation_server, ParameterValue=utf8_general_ci, ApplyMethod=immediate" \
--parameters="ParameterName=slow_query_log, ParameterValue=1, ApplyMethod=immediate" \
--parameters="ParameterName=log_queries_not_using_indexes, ParameterValue=1, ApplyMethod=immediate" \
--parameters="ParameterName=max_allowed_packet, ParameterValue=67108864, ApplyMethod=immediate" \
--parameters="ParameterName=log_bin_trust_function_creators, ParameterValue=1, ApplyMethod=immediate" \
--parameters="ParameterName=tmp_table_size, ParameterValue={DBInstanceClassMemory/16}, ApplyMethod=immediate" \
--parameters="ParameterName=max_heap_table_size, ParameterValue={DBInstanceClassMemory/16}, ApplyMethod=immediate" \
#!/bin/sh
mysql -NBe "SHOW DATABASES;" | grep -v 'lost+found' \
| while read database ; do
#skip system-db
if [ "$database" = "mysql" ] ; then
continue
fi
mysql -NBe "SHOW TABLE STATUS;" $database \
| while read name engine version rowformat rows avgrowlength \
SELECT
DATE_FORMAT(
sales_flat_order.created_at,
'%Y-%m-%d'
) AS DAY,
CONCAT(
'$',
FORMAT(
SUM(sales_flat_order.`grand_total`),
2
#!/bin/bash
#
# Whitelist Pingdom probe-servers in iptables.
#
# Create a chain called "PINGDOM" and jump to it somewhere before
# the final REJECT/DROP, e.g.
#
# # New chain for Pingdom rules
# :PINGDOM - [0:0]
#
@dgitman
dgitman / csv_splitter.py
Created March 14, 2016 17:09 — forked from jrivero/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
@dgitman
dgitman / System Design.md
Created April 26, 2016 16:54 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@dgitman
dgitman / osx-for-hackers.sh
Created July 5, 2016 13:14 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
<!-- Questions
1- Format/Structuer the Html code above
2- Make the "Hello Cue" title Blue and bold, with text size = 20px
3- Make span lined up with the Hello Cue title
4- Use JQuery to Change the Title to "Hello Dolly" and to Add a new class named "cue-link"
5- Add this HTML tag "<cue id='cue-stream'>My List</cue>" next to the <span> and make the span and the cue tag shows in a separate new line
6- Use Css to style the <cue> and make it with a pointer on hover-over
-->
@dgitman
dgitman / local.xml
Last active February 20, 2018 16:00 — forked from jasontipton/local.xml
Magento Local.xml NOINDEX/NOFOLLOW Catalog Search
<?xml version="1.0"?>
<layout version="0.1.0">
<!-- Search Results page -->
<catalogsearch_result_index>
<reference name="head">
<action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action>
</reference>
</catalogsearch_result_index>