Skip to content

Instantly share code, notes, and snippets.

View mikebranderhorst's full-sized avatar

Mike Branderhorst mikebranderhorst

  • Deo Volente Research
  • The Netherlands
View GitHub Profile
#!/bin/sh
#
# @author Matt Korostoff <[email protected]>
#
# @internal stop and then restart varnish
#
# @category apache
#
# @copyright Licensed under the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
#!/bin/sh
#
# @author Matt Korostoff <[email protected]>
#
# @internal stop varnish, restart apache on port 80
#
# @category apache
#
# @copyright Licensed under the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
#!/bin/sh
#
# @author Matt Korostoff <[email protected]>
#
# @internal start varnish on port 80, switch apache to 8000
#
# @category apache
#
# @copyright Licensed under the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
@peterjaap
peterjaap / Mage_Catalog_Model_Resource_Url_getProduct.php
Last active May 4, 2017 06:09
Modified Mage_Catalog_Model_Resource_Url::_getProduct function. This function now contains a boolean that you can set to switch between rewriting the URL's for ALL products and rewriting only the URL's of products that are visible. Idea inspired by Alan Storm's blog on Scaling Magento - http://alanstorm.com/scaling_magento_at_copious
<?php
protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
{
$products = array();
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$adapter = $this->_getReadAdapter();
if ($productIds !== null) {
if (!is_array($productIds)) {
$productIds = array($productIds);
@chales
chales / cache-warmer-3.sh
Last active January 19, 2022 14:01
A couple of simple options to parse sitemap.xml to warm the cache or for other actions such as generating memory_profiler checks.
# This can be added to your cron job to run right after Drupal's cron or combine them into a single command so
# that it automatically executes when the cron run completes.
wget -q http://www.example.com/sitemap.xml -O - | egrep -o "http://www\.example\.com[^<]+" | wget -q -i - -O /dev/null --wait 1
@hofmannsven
hofmannsven / README.md
Last active July 30, 2025 13:50
Git CLI Cheatsheet
@wqweto
wqweto / check_vat.php
Last active December 14, 2023 11:00
Check company VAT number using SOAP service at http://ec.europa.eu and return JSON encoded result
<?php
header('Content-type: application/json; charset=utf8');
$vatno = str_replace(array(' ', '.', '-', ',', '"'), '', $_GET['vatno']);
echo serviceCheckVat($vatno, &$name, &$address, &$error);
/*
include "connect.php";
mysql_query("SET NAMES utf8");
$vatno = mysql_real_escape_string($_GET['vatno']);
@lennyjpg
lennyjpg / mysqlbackup.sh
Last active December 7, 2018 11:34
backup mysqldump over ssh tunnel into gpg
#! /bin/sh
# open tunnel
ssh -v -M -f -N -L 3306:localhost:3306 "$1" -S /tmp/ssh-control
# dump sql, gzip, encrypt with openssl
mysqldump -u root -p"$3" "$2" --host 127.0.0.1 | gzip | openssl aes-256-cbc -salt -out mysqldump.aes -k "$4"
# close tunnel
ssh -S /tmp/ssh-control -O exit "$1"
@nyov
nyov / magento-cli.py
Last active August 15, 2021 12:57
A Magento REST API example with rauth as OAuth provider. For Magento 1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rauth.service import OAuth1Service
# Create consumer key & secret in your Magento Admin interface
# For an API Guideline see:
# http://www.magentocommerce.com/api/rest/authentication/oauth_authentication.html
#
# Short Magento setup explanation:
@atouchard
atouchard / varnish-install.sh
Last active September 29, 2021 16:16
Install Varnish on MacOSX via Homebrew
#!/bin/sh
#
# Install Varnish via Homebrew
#
# You need to add /usr/local/sbin in your PATH
# vcl files are in /usr/local/etc/varnish
#
# Usage :