Skip to content

Instantly share code, notes, and snippets.

💭
Stay'n cold in Minnesota

Tegan Snyder tegansnyder

💭
Stay'n cold in Minnesota
Block or report user

Report or block tegansnyder

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
@tegansnyder
tegansnyder / Install go 1.6 RHEl 7.md
Last active Jun 19, 2019
Install go 1.6 RHEl 7
View Install go 1.6 RHEl 7.md
# download latest https://golang.org/dl/
wget https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz
tar xzvf go1.6.3.linux-amd64.tar.gz

# system wide install
sudo mv go /usr/local/

# add system wide path
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active May 28, 2019
HHVM Magento Server Setup
View hhvm_magento_setup.md

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
@tegansnyder
tegansnyder / debugging reindex locks mysql commands.md
Created Dec 2, 2014
Useful Mysql Commands for Debugging Magento Reindex Locks
View debugging reindex locks mysql commands.md

Sometimes you may have a run away reindex process that aborted due to a MySQL connection error of some sorts. It may be useful to use the following MySQL commands to aid in debugging.

Determining if a lock exists

Magento Enterprise labels the reindex lock via the constant REINDEX_FULL_LOCK in app/code/core/Enterprise/Index/Model/Observer.php

SELECT IS_FREE_LOCK('mydatabase_name.reindex_full')

Returns 1 is specified lock is free and can be acquired, 0 if it’s in use, NULL if an error occurs.

Determing the thread that is holding the lock

@tegansnyder
tegansnyder / apache spark csv sql.md
Last active Apr 26, 2019
Apache Spark querying a CSV using SQL Context
View apache spark csv sql.md
Using Apache Spark to Query a CSV Like with SQL like syntax.

Load up the spark shell with the appropriate package for csv parsing:

./bin/spark-shell --packages com.databricks:spark-csv_2.10:1.1.0

In the scala terminal type the following, referencing the path to your csv file. Example below:

import org.apache.spark.sql.SQLContext
View pyspark error.md

I'm recieving a strange error on a new install of Spark. I have setup a small 3 node spark cluster on top of an existing hadoop instance. The error I get is the same for any command I try to run on pyspark shell I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/spark/python/pyspark/rdd.py", line 1041, in count
    return self.mapPartitions(lambda i: [sum(1 for _ in i)]).sum()
  File "/opt/spark/python/pyspark/rdd.py", line 1032, in sum
    return self.mapPartitions(lambda x: [sum(x)]).fold(0, operator.add)
  File "/opt/spark/python/pyspark/rdd.py", line 906, in fold
@tegansnyder
tegansnyder / abandon-cart.sql
Created Jun 16, 2014
Abandon cart Magento MySQL query example
View abandon-cart.sql
SELECT `main_table`.*, (main_table.base_subtotal_with_discount*main_table.base_to_global_rate) AS `subtotal`, `cust_email`.`email`, `cust_fname`.`value` AS `firstname`, `cust_lname`.`value` AS `lastname`, CONCAT_WS(' ', cust_fname.value, cust_lname.value) AS `customer_name` FROM `sales_flat_quote` AS `main_table`
INNER JOIN `customer_entity` AS `cust_email` ON cust_email.entity_id = main_table.customer_id
INNER JOIN `customer_entity_varchar` AS `cust_fname` ON cust_fname.entity_id = main_table.customer_id AND cust_fname.attribute_id = 5
INNER JOIN `customer_entity_varchar` AS `cust_lname` ON cust_lname.entity_id = main_table.customer_id AND cust_lname.attribute_id = 7 WHERE (items_count != '0') AND (main_table.is_active = '1') AND (main_table.created_at >= '2014-06-15 00:00:00') ORDER BY updated_at DESC
@tegansnyder
tegansnyder / grab-all-product-attributes.sql
Created Jan 20, 2014
Magento grab all product attributes for a SKU in direct SQL. "static" backend_type attributes are stored in catalog_product_entity
View grab-all-product-attributes.sql
SELECT * FROM ( SELECT
ce.sku,
ea.attribute_id,
ea.attribute_code,
CASE ea.backend_type
WHEN 'varchar' THEN ce_varchar.value
WHEN 'int' THEN ce_int.value
WHEN 'text' THEN ce_text.value
WHEN 'decimal' THEN ce_decimal.value
WHEN 'datetime' THEN ce_datetime.value
@tegansnyder
tegansnyder / manual-dataflow-profile.php
Created Jan 28, 2014
Running a Magento Dataflow profile manually
View manual-dataflow-profile.php
<?php
/*
Author: Tegan Snyder <tsnyder@tegdesign.com>
Example of running a Dataflow profile via command line
you can change the profile_id to the one you want to
run and issue:
time php manual-dataflow-profile.php
note you may need to increase the memory_limit in php cli's php_cli.ini
RHEL linux copy /etc/php.ini to /etc/php_cli.ini and make changes there then restart Apache.
@tegansnyder
tegansnyder / opcache.ini
Last active Mar 12, 2019
OpCache settings for Magento on PHP 5.5.14. Store this file as /etc/php.d/opcache.ini
View opcache.ini
; Enable Zend OPcache extension module
zend_extension=opcache.so
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0
; The OPcache shared memory storage size.
@tegansnyder
tegansnyder / Upgrading Elastic Search to 2.3 - Steps I took.md
Last active Feb 11, 2019
Upgrading Elastic Search to 2.3 - Steps I took
View Upgrading Elastic Search to 2.3 - Steps I took.md

Details of steps I took on each node in a nine node ES cluster on RHEL7. These steps need to occur one node at a time, i.e. "rolling upgrade")

Step 1: Disable shard allocation

curl -XPUT "http://localhost:9200/_cluster/settings" -d'
{
  "transient": {
    "cluster.routing.allocation.enable": "none"
  }
}'
You can’t perform that action at this time.