Skip to content

Instantly share code, notes, and snippets.

View brentwpeterson's full-sized avatar

Brent W. Peterson brentwpeterson

View GitHub Profile
@brentwpeterson
brentwpeterson / translate.py
Created May 2, 2023 13:57 — forked from markshust/captions.py
Python script to use Whisper to create srt's for all mp4's that don't currently have one in the current directory.
import os
import whisper
from whisper.utils import get_writer
# Get the current directory path
directory = os.getcwd()
# Loop through all the files in the directory
for file in sorted(os.listdir(directory)):
@brentwpeterson
brentwpeterson / zips-tc-metro.txt
Created June 15, 2020 21:12 — forked from Radcliffe/zips-tc-metro.txt
ZIP codes in the seven county twin cities metropolitan area
ZIP Code,County
55001,Washington County
55003,Washington County
55005,Anoka County
55010,Dakota County
55011,Anoka County
55014,Anoka County
55016,Washington County
55020,Scott County
55024,Dakota County
@brentwpeterson
brentwpeterson / Dynamic events
Created October 26, 2016 12:56 — forked from digitalpianism/Dynamic events
Magento 1.9.3.0: list of dispatched events
$this->_eventPrefix.'_clear' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_delete_after' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_delete_before' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_delete_commit_after' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_load_after' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_load_before' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_save_after' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_save_before' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_save_commit_after' // Mage_Core_Model_Abstract
$this->_eventPrefix.'_load_after' // Mage_Core_Model_Resource_Db_Collection_Abstract
@brentwpeterson
brentwpeterson / 01-SolrSetup.md
Created April 21, 2016 20:17 — forked from petemcw/01-SolrSetup.md
Basic configuration steps for setting up Solr 3.x on CentOS/RHEL 6.4 -- specifically for use with Magento Enterprise

Installing Solr on CentOS/RHEL 6

From the Apache Software Foundation, "Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON, Ruby, and Python APIs, hit highlighting, faceted search, caching, replication, and a web administration interface." Magento has had built-in support for Solr since Enterprise verion 1.8.

The following instructions show how to complete a basic installation and configuration of Apache Solr for use with Magento Enterprise on CentOS/RHEL 6. These instructions the Java JDK with Tomcat rather than jetty.

Note: Solr should be on a dedicated server if possible, especially for large installations, as it can be resource intensive

Install Java JDK

@brentwpeterson
brentwpeterson / PATCH_SUPEE-389_EE_1.12.0.2_v2.sh
Created February 2, 2016 13:47 — forked from piotrekkaminski/PATCH_SUPEE-389_EE_1.12.0.2_v2.sh
SUPEE-389: Every time the catalog URL is rendexed, a new custom rewrite is created
#!/bin/bash
# Patch apllying tool template
# v0.1.2
# (c) Copyright 2013. Magento Inc.
#
# DO NOT CHANGE ANY LINE IN THIS FILE.
# 1. Check required system tools
_check_installed_tools() {
local missed=""
@brentwpeterson
brentwpeterson / getMagentoPatches.php
Created November 2, 2015 13:17 — forked from Schrank/getMagentoPatches.php
Download all magento patches (once), and sort them into the correct directory, so you have all patches for a single version by hand.
class PatchDownloader
{
/**
* @var string
*/
private $infoUrl = "https://MAGEID:[email protected]/products/downloads/info/filter/version/";
/**
* @var string
*/
private $downloadUrl = "https://MAGEID:[email protected]/products/downloads/file/";
@brentwpeterson
brentwpeterson / install-redis.sh
Last active August 29, 2015 14:26 — forked from FUT/install-redis.sh
Install Redis on EC2
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Chicago \
/etc/localtime
sudo yum -y install gcc make
2. Download, Untar and Make Redis 3.0.3 (check here http://redis.io/download)
protected function isConfigurable($productId){
if(Mage::getModel('catalog/product')->load($productId)->isConfigurable()){
return true;
}
else{
return false;
}
}
...///
@brentwpeterson
brentwpeterson / cart-item
Created September 17, 2012 15:43
Get Magento Line item (Order) when item is configurable.
Product in order is configurable::
foreach ($products as $item){
echo $item->getProductType() . '<br>';
echo $item->getSku() . '<br>';
echo $item->getPrice() . '<br>';
echo $item->getQtyOrdered() . '<br>';
echo '<hr>';
}