Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / iptables.sh
Last active Aug 29, 2015
nginx UserAgent Blacklist, so i found this UserAgent on different system.
View iptables.sh
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 Mar 21, 2014
Wordpress DDoS via Pingback
View .htaccess
<FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
Order Deny,Allow
Deny from all
</FilesMatch>
@mklooss
mklooss / install-1.0.0.0.php
Last active Aug 29, 2015
Dummy Installer Element for Magento
View install-1.0.0.0.php
<?php
$installer = $this;
/* @var Loewenstark_Dummy_Model_Resource_Setup $installer */
$installer->startSetup();
$mail = '';
$name = '';
$company = '';
$phone = '';
$fax = '';
@mklooss
mklooss / reindex.php
Last active Aug 29, 2015
Magento Reindex All, some parts from AvS_Fastsimpleimport :)
View reindex.php
<?php
if(php_sapi_name() != 'cli')
{
echo "only for cli!";
exit;
}
require 'app/Mage.php';
Mage::app('admin');
@mklooss
mklooss / gist:bea85aa34aeb4b098023
Created Jun 2, 2014
copy Parent/Simple Category to each other
View gist:bea85aa34aeb4b098023
<?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 Jun 12, 2014
Magento: The Directive on Consumer Rights - 2014-06-13 - Helper
View class.php
<?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 Jun 27, 2014
M2E Fix for Tax on Shipping Costs issues - ebay orders- thanks to M2E support :) - for version 6.1.6
View Configurator.php
<?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 Aug 29, 2015
Auto Add Items to Amazon Listing - m2e
View addItemsM2e.php
<?php
if(php_sapi_name() != 'cli')
{
echo "only for cli!";
exit;
}
require 'app/Mage.php';
Mage::app('admin');
@mklooss
mklooss / Helper_Search.php
Created Jul 15, 2014
Add Category Names to CatalogSearch
View Helper_Search.php
<?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 Sep 17, 2014
Mage Disable Key Validation
View Observer.php
<?php
class Observer
{
/**
* mageEvent: <controller_action_predispatch_checkout_cart_add>
*
*/
public function addDisableValidatFromKey(Varien_Event_Observer $observer)
{
$controller = $observer->getControllerAction();