Skip to content

Instantly share code, notes, and snippets.

View gwillem's full-sized avatar
💫

Willem de Groot gwillem

💫
View GitHub Profile
import tornado
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.httpclient import AsyncHTTPClient
from tornado.queues import Queue
q = Queue(maxsize=0)
@gen.coroutine
def producer():
diff --git app/code/core/Mage/Api/Model/Server/Adapter/Soap.php app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
index 0f9a3fa..1ac0d57 100644
--- app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
+++ app/code/core/Mage/Api/Model/Server/Adapter/Soap.php
@@ -233,9 +233,9 @@ class Mage_Api_Model_Server_Adapter_Soap
: $urlModel->getUrl('*/*/*');
if ( $withAuth ) {
- $phpAuthUser = $this->getController()->getRequest()->getServer('PHP_AUTH_USER', false);
- $phpAuthPw = $this->getController()->getRequest()->getServer('PHP_AUTH_PW', false);
@gwillem
gwillem / 1533.diff
Created June 22, 2015 12:26
Magento patches
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)));
diff --git app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
index 9a1710d..04ba86b 100644
--- app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
+++ app/code/core/Mage/Authorizenet/controllers/Directpost/PaymentController.php
@@ -68,6 +68,8 @@ class Mage_Authorizenet_Directpost_PaymentController extends Mage_Core_Controlle
public function responseAction()
{
$data = $this->getRequest()->getPost();
+ unset($data['redirect_parent']);
+ unset($data['redirect']);
@gwillem
gwillem / DiskInodes.py
Created May 26, 2015 10:00
Inode monitoring for Server Density
import os
class DiskInodes(object):
def __init__(self, agent_config, checksLogger, rawConfig):
self.agent_config = agent_config
self.checks_logger = checksLogger
self.raw_config = rawConfig
@gwillem
gwillem / test_helpers.py
Created May 19, 2015 11:29
Functional testing of config management (Ansible, Puppet, Chef, etc)
"""
Various helper functions to aid in node testing (aka provisioning testing aka unit testing)
"""
from functools import wraps
import hashlib
import os
from pwd import getpwuid
from grp import getgrgid
import re
@gwillem
gwillem / check-enough-space.sh
Last active October 18, 2016 21:04
Create Hypernode copy of live site
# is there enough space?
DBNAME=$(magerun --root-dir=~/public db:info dbname)
USAGE_FILE=$(( ( $(du -s --exclude=public/media/\* ~/public | cut -f1) - $(du -s --exclude=public/media/\* ~/staging | cut -f1) ) / 1024 ))
USAGE_DB=$(( $(du -s --exclude= /data/mysql/$DBNAME | cut -f1) / 1024 ))
FREE_SPACE_PRE=$(( $(stat -f --format='%a*%S/1024' ~/public) / 1024 ))
FREE_SPACE_POST=$(( $FREE_SPACE_PRE - $USAGE_FILE - $USAGE_DB ))
# Todo: which db tables to exclude? these: magerun db:dump --stdout --only-command --strip="@stripped" | sed -e 's/ /\n/g' | grep ignore-table | cut -d. -f2
@gwillem
gwillem / run-nr-bench.sh
Created November 26, 2014 18:50
Newrelic small benchmark
#!/bin/bash
set -e
function tt () {
curl -kso /dev/null -w "%{time_total}\n" $1
}
#alias ttfb='curl -kso /dev/null -w "%{time_starttransfer}\n"'
@gwillem
gwillem / CloudVPS
Created November 15, 2014 15:11
CloudVPS vs Tilaa vs DigitalOcean
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Xen Virtual CPU
stepping : 4
microcode : 0x417
cpu MHz : 2593.796
cache size : 20480 KB
physical id : 0
@gwillem
gwillem / .gitconfig
Last active August 24, 2016 16:03
My .gitconfig
[alias]
c = commit -m
a = add
aa= !git add -u && git add . && git status
cb = checkout -b
up = !git fetch origin && git rebase origin/master
ir = !git rebase -i origin/master
done = !git fetch && git rebase origin/master && git checkout master && git merge @{-1} && rake && git push
p = pull --rebase --verbose --stat --prune
po = !git push -u origin $(git describe --contains --all HEAD)