Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / iptables.sh
Last active August 29, 2015 13:56
nginx UserAgent Blacklist, so i found this UserAgent on different system.
for ip in $(grep -ri Baidu /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done
for ip in $(grep -ri 200please /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done
for ip in $(grep -ri majestic12 /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done
for ip in $(grep -ri opensiteexplorer /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done
for ip in $(grep -ri seokicks /var/log/nginx/access.log | cut -f1 -d' ' | sort | uniq); do echo $ip && iptables -I INPUT -s $ip -j DROP; done
@mklooss
mklooss / .htaccess
Created March 21, 2014 10:18
Wordpress DDoS via Pingback
<FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
Order Deny,Allow
Deny from all
</FilesMatch>
@mklooss
mklooss / install-1.0.0.0.php
Last active August 29, 2015 13:57
Dummy Installer Element for Magento
<?php
$installer = $this;
/* @var Loewenstark_Dummy_Model_Resource_Setup $installer */
$installer->startSetup();
$mail = '';
$name = '';
$company = '';
$phone = '';
$fax = '';
@mklooss
mklooss / reindex.php
Last active August 29, 2015 13:57
Magento Reindex All, some parts from AvS_Fastsimpleimport :)
<?php
if(php_sapi_name() != 'cli')
{
echo "only for cli!";
exit;
}
require 'app/Mage.php';
Mage::app('admin');
@mklooss
mklooss / gist:bea85aa34aeb4b098023
Created June 2, 2014 13:21
copy Parent/Simple Category to each other
<?php
require 'app/Mage.php';
Mage::app('admin');
$resource = Mage::getSingleton('core/resource');
/* @var $resource Mage_Core_Model_Resource */
$conn = $resource->getConnection('core_write');
/* @var $conn Varien_Db_Adapter_Interface */
@mklooss
mklooss / class.php
Created June 12, 2014 07:04
Magento: The Directive on Consumer Rights - 2014-06-13 - Helper
<?php
/**
class required this modul:
https://github.com/integer-net/Autoshipping
*/
class Custom_Module_Helper_Eu_Shipment
extends Mage_Core_Helper_Abstract
{
@mklooss
mklooss / Configurator.php
Created June 27, 2014 11:47
M2E Fix for Tax on Shipping Costs issues - ebay orders- thanks to M2E support :) - for version 6.1.6
<?php
/*
* @copyright Copyright (c) 2013 by ESS-UA.
*/
/**
* Configures the store settings to match account settings and order information
*/
class Ess_M2ePro_Model_Magento_Quote_Store_Configurator
@mklooss
mklooss / addItemsM2e.php
Last active August 29, 2015 14:03
Auto Add Items to Amazon Listing - m2e
<?php
if(php_sapi_name() != 'cli')
{
echo "only for cli!";
exit;
}
require 'app/Mage.php';
Mage::app('admin');
@mklooss
mklooss / Helper_Search.php
Created July 15, 2014 14:46
Add Category Names to CatalogSearch
<?php
class Custom_MyModule_Helper_Search
extends Mage_CatalogSearch_Helper_Data
{
public function getSearchableDataFromCategory($productId, $storeId)
{
$result = array();
$default = Mage::app()->getStore($storeId)->getRootCategoryId();
$adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
@mklooss
mklooss / Observer.php
Created September 17, 2014 14:07
Mage Disable Key Validation
<?php
class Observer
{
/**
* mageEvent: <controller_action_predispatch_checkout_cart_add>
*
*/
public function addDisableValidatFromKey(Varien_Event_Observer $observer)
{
$controller = $observer->getControllerAction();