Skip to content

Instantly share code, notes, and snippets.

View gwillem's full-sized avatar
💫

Willem de Groot gwillem

💫
View GitHub Profile
diff --git app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
index c698108..6e256bb 100644
--- app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
+++ app/code/core/Mage/Adminhtml/Block/Dashboard/Graph.php
@@ -444,7 +444,7 @@ class Mage_Adminhtml_Block_Dashboard_Graph extends Mage_Adminhtml_Block_Dashboar
}
return self::API_URL . '?' . implode('&', $p);
} else {
- $gaData = urlencode(base64_encode(serialize($params)));
+ $gaData = urlencode(base64_encode(json_encode($params)));
@gwillem
gwillem / iopsmon.sh
Created September 22, 2015 14:28
Monitor I/O heavy SQL queries and PHP requests on Hypernode
#!/bin/bash
# monitors iops per 30 sec interval, and prints current http and sql transactions if iops avg > 100
while true; do
iops=$(iostat xvdf -d 30 2 | tail -2 | head -1 | awk '{print $2}' | cut -d. -f1)
if [[ "$iops" -gt 100 ]]; then
echo "-------------------------------------------------------------------"
echo "IOPS: $iops"
echo
@gwillem
gwillem / http.txt
Created October 29, 2015 13:06
M2ePro POST dump
POST /index.php/M2ePro/cron/index/ HTTP/1.1
Accept: */*
Host: xxxx
Cookie: testcookie=ok
User-Agent: M2E Pro Cron Service/1.0
Content-Length: 325
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------3e1c79a414da
------------------------------3e1c79a414da
@gwillem
gwillem / parse.py
Last active November 29, 2015 16:20
Parse http logfile to find disguised robots
import gzip
import csv
import sys
from netaddr import IPNetwork, IPAddress
from collections import defaultdict
from pprint import pprint
"""
20151129 gwillem@gmail.com
Written to assert Peter Jaaps suspicions about disguised crawlers from competitors
@gwillem
gwillem / gist:6751384
Created September 29, 2013 10:44
Debug vagrant-lxc #150
INFO global: Vagrant version: 1.3.3
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.3/plugins/provisioners/salt/plugin.rb
INFO manager: Registered plugin: salt
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.3/plugins/provisioners/shell/plugin.rb
INFO manager: Registered plugin: shell
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.3/plugins/provisioners/ansible/plugin.rb
INFO manager: Registered plugin: ansible
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.3/plugins/provisioners/file/plugin.rb
INFO manager: Registered plugin: file
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.3/plugins/provisioners/cfengine/plugin.rb
@gwillem
gwillem / Original
Created January 15, 2014 13:59
Magento url indexer partitioning
SELECT
CONCAT(r.identifier, CASE WHEN ur.inc IS NULL OR `m`.`value` = 1 THEN '' ELSE CONCAT('-', ur.inc) END) AS `request_path`,
`r`.`target_path`,
'3beb48718b9de2b903447079560756bc' AS `guid`,
0 AS `is_system`,
CONCAT(r.identifier, CASE WHEN ur.inc IS NULL OR `m`.`value` = 1 THEN '' ELSE CONCAT('-', ur.inc) END) AS `identifier`,
`r`.`redirect_id` AS `value_id`,
`r`.`store_id`, 1 AS `entity_type`
FROM `enterprise_url_rewrite_redirect` AS `r`
LEFT JOIN `enterprise_url_rewrite` AS `ur` ON ur.identifier = r.identifier AND ur.store_id = r.store_id AND ur.entity_type = 1
diff --git app/code/core/Mage/Admin/Model/Observer.php app/code/core/Mage/Admin/Model/Observer.php
index 9c04324..9d39424 100644
--- app/code/core/Mage/Admin/Model/Observer.php
+++ app/code/core/Mage/Admin/Model/Observer.php
@@ -34,6 +34,7 @@
class Mage_Admin_Model_Observer
{
const FLAG_NO_LOGIN = 'no-login';
+
/**
#!/usr/bin/env python3.5
import asyncssh
import asyncio
import sys
"""
Testing for 200 hosts:
5 => 40s
@gwillem
gwillem / fake-user-agents.txt
Last active January 26, 2016 14:02
Transip Runaway Crawler
1st ZipCommander (Net) - http://www.zipcommander.com/
Ace Explorer
ActiveBookmark 1.x
Activeworlds
ActiveWorlds/3.xx (xxx)
Advanced Browser (http://www.avantbrowser.com)
Amiga-AWeb/3.4.167SE
AmigaVoyager/3.4.4 (MorphOS/PPC native)
annotate_google; http://ponderer.org/download/annotate_google.user.js
ANTFresco/x.xx
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
vda 0.00 0.00 0.00 0.40 0.00 2.40 12.00 1.48 3636.00 0.00 3636.00 2500.00 100.00