Skip to content

Instantly share code, notes, and snippets.

View steverobbins's full-sized avatar

Steve Robbins steverobbins

View GitHub Profile
@steverobbins
steverobbins / 00-magento-session-db-gc-non-locking-readme.md
Last active January 18, 2021 05:18
Clean Magento's core_session table in background

Script to "safely" clean up the core_session table without causing lock wait timeouts.

Not thoroughly vetted but met the client's needs.

Requires disabling Mage_Core_Model_Resource_Session:gc(), e.g.

--- a/app/code/core/Mage/Core/Model/Resource/Session.php
+++ b/app/code/core/Mage/Core/Model/Resource/Session.php
@@ -74,7 +74,7 @@ class Mage_Core_Model_Resource_Session implements Zend_Session_SaveHandler_Inter
Verifying that +steverobbins is my blockchain ID. https://onename.com/steverobbins
<?php
ini_set('display_errors', 1);
session_save_path('tcp://127.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10');
session_module_name('memcache');
session_start();
$sesTime = 'first time';
if (isset($_SESSION['memc_time'])) $sesTime = $_SESSION['memc_time'];
@steverobbins
steverobbins / save-ip-to-dropbox
Last active December 21, 2015 03:50
Cron script I leave running on my home computer in case my ISP decides to change my IP
#!/bin/bash
BIN_CURL=$(which curl)
FILE_IP=/Users/steve/Dropbox/ip-home
URL_DETECT=icanhazip.com
echo "Config values:
curl bin: $BIN_CURL
ip file: $FILE_IP
detection url: $URL_DETECT
select p.id, p.sku, p.upc, json_get(p.custom_data, 'pricing_guide') pricing_guide, p.long_name
from products p
inner join amazonproducts ap on ap.product_id = p.id
where
(
json_get(p.custom_data, 'life_cycle', 0) != 'Pre-Release'
or (
json_get(p.custom_data, 'life_cycle', 0) != 'Active'
and json_get(p.custom_data, 'product_group') != 'Machines'
)
#!/bin/bash
BUCKET=ellisonmagentobackups
TMPDIR=/mnt/shared/tmp
BACKUPITEMS="app erp errors media shell var wp"
DATESTAMP=`date +"%Y%m%d.%H%M%S"`
date
echo "Shared backup started"
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
#
# Do NOT simply read the instructions in here without understanding
SELECT TOP 1000 p.[Name]
,p.[Price_Base]
,p.[Price_Wholesale]
,p.[Price_List]
,p.[Price_Site]
,p.[Price_Promotional]
,p.[StockStatus]
,p.[PartNumber]
,p.[TagLine]
,p.[SmallDescription]
update core_config_data set value = 'http://www.sizzix.com/' where path = 'web/unsecure/base_url' and scope = 'default' and scope_id = 0;
update core_config_data set value = 'https://www.sizzix.com/' where path = 'web/secure/base_url' and scope = 'default' and scope_id = 0;
update core_config_data set value = 'http://www.ellison.com/' where path = 'web/unsecure/base_url' and scope = 'websites' and scope_id = 4;
update core_config_data set value = 'https://www.ellison.com/' where path = 'web/secure/base_url' and scope = 'websites' and scope_id = 4;
update core_config_data set value = 'http://www.ellisoneducation.com/' where path = 'web/unsecure/base_url' and scope = 'websites' and scope_id = 5;
update core_config_data set value = 'https://www.ellisoneducation.com/' where path = 'web/secure/base_url' and scope = 'websites' and scope_id = 5;
update core_config_data set value = 'http://www.sizzix.co.uk/' where path = 'web/unsecure/base_url' and scop
lock '3.4.0'
set :application, 'magento'
set :repo_url, 'git@example.com:company/repo.git'
set :keep_releases, 10
app_symlinks = ['app/etc/local.xml', 'media', 'var']
namespace :magento do
desc 'Symlink shared files and folders'