Skip to content

Instantly share code, notes, and snippets.

View steverobbins's full-sized avatar

Steve Robbins steverobbins

View GitHub Profile
@steverobbins
steverobbins / Paypal.php
Last active April 22, 2024 12:18
PayPal API Requests
<?php
class Paypal
{
/**
* API Version
*/
const VERSION = 51.0;
/**
#!/bin/bash
dynmotd () {
local NONE="\033[0m" # unsets color to term's fg color
# regular colors
local K="\033[0;30m" # black
local R="\033[0;31m" # red
local G="\033[0;32m" # green
local Y="\033[0;33m" # yellow
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'dev/log/active', '1') on duplicate key update `value`='1';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/session_cookie_lifetime', '360000') on duplicate key update `value`='360000';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'web/cookie/cookie_lifetime', '360000') on duplicate key update `value`='360000';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/password_is_forced', '0') on duplicate key update `value`='0';
insert into core_config_data (`scope`, scope_id, `path`, `value`) values('default', 0, 'admin/security/password_is_forced', '0') on duplicate key update `value`='0';
update core_config_data set value = 'http://project.192.168.50.100.xip.io/' where path like '%base_url';
update core_config_data set value = ''
@steverobbins
steverobbins / magento-ioncube-module-info.php
Last active May 12, 2021 21:32
Display what information we can about Magento1 objects that are ioncubed (or any class really)
<?php ini_set('display_errors', 1) ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<?php
// we need the autoloader
include 'app/Mage.php';
$classes = array(
create table trigger_execution_log (
id int not null auto_increment,
ran_at timestamp default current_timestamp,
trigger_name varchar(255) not null,
message varchar(255),
primary key (id)
);
DELIMITER $$
@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
@steverobbins
steverobbins / archive.sh
Last active April 1, 2020 18:42
Quick and dirty script to save a whole site to archive.org
#!/bin/bash
URL=$1
PATH=$2
EXCLUDE=$3
/bin/rm -rf "$URL"
echo "Gathering URLs..."
select sfoi.sku, sum(sfoi.qty_ordered) sold, sum(sfoi.base_price) dollaramount
from sales_flat_order_item sfoi
group by sfoi.sku
order by sold desc
#!/bin/bash
################################################################################
# FUNCTIONS
################################################################################
# 1. Check required system tools
_check_installed_tools() {
local missed=""
<?php
$files = glob('*');
$reports = array();
foreach ($files as $file) {
if (!is_numeric($file)) {
continue;
}
$time = filemtime($file);