Skip to content

Instantly share code, notes, and snippets.

View gwillem's full-sized avatar
💫

Willem de Groot gwillem

💫
View GitHub Profile
@gwillem
gwillem / gist:9089433
Created February 19, 2014 10:25
pivotal unreachable
$ traceroute www.pivotaltracker.com
traceroute to www.pivotaltracker.com (67.214.223.103), 30 hops max, 60 byte packets
1 corona.r139.net (192.168.101.1) 0.151 ms 0.133 ms 0.114 ms
2 nl-asd-dc2-ias-arg37.kpn.net (62.12.4.5) 1.029 ms 1.034 ms 1.025 ms
3 nl-asd-dc2-zsi-sg01-xe-1-3-0.kpn.net (139.156.113.156) 1.480 ms 1.491 ms 1.479 ms
4 nl-asd-dc2-ice-ir01.kpn.net (139.156.222.65) 5.439 ms 5.448 ms 9.392 ms
5 ams-ix.ae1.cr1.ams2.nl.nlayer.net (195.69.145.219) 3.288 ms 3.307 ms 3.276 ms
6 ae3-50g.cr1.ams2.nl.nlayer.net (69.22.139.238) 1.935 ms 15.841 ms 1.986 ms
7 * xe-5-3-0.cr1.lhr1.uk.nlayer.net (69.22.142.94) 9.420 ms 10.844 ms
8 ae0-40g.cr1.lhr2.uk.nlayer.net (69.22.139.117) 9.397 ms 11.892 ms xe-4-0-1.cr1.ewr1.us.nlayer.net (69.22.142.30) 86.096 ms
@gwillem
gwillem / pdns-subdomain-wildcard.md
Last active August 29, 2015 14:03
PowerDNS changed behaviour between 2.9 and 3.3.1

Database entries

domain_id	name	type	content
55392	domain.nl	SOA     nsa.byte.nl. hostmaster.byte.nl. 2003030410
55392	domain.nl	NS      nsa.byte.nl
55392	domain.nl	NS      nsb.byte.nl
55392	domain.nl	NS      nsc.byte.nl

55392	domain.nl      A       46.21.227.210
55392	*.domain.nl    A       46.21.227.210
@gwillem
gwillem / axfr
Last active August 29, 2015 14:03
PowerDNS unexpected NXDomain
$ dig @10.1.1.60 internal -t AXFR
; <<>> DiG 9.7.3 <<>> @10.1.1.60 internal -t AXFR
; (1 server found)
;; global options: +cmd
internal. 600 IN SOA nsa.byte.nl. hostmaster.byte.nl. 2009121500 10800 3600 604800 3600
localhost.internal. 604800 IN A 127.0.0.1
internal. 43200 IN NS nsa.byte.nl.
internal. 43200 IN NS nsb.byte.nl.
internal. 43200 IN NS nsc.byte.nl.
[...]
@gwillem
gwillem / parse-json-lines.py
Last active August 29, 2015 14:06
Smart JSON line parser (for logs etc)
#!/usr/bin/env python
"""
Usage:
$ grep '"status":"200"' /var/log/nginx/access.log | parse-json-lines status,referer
200 http://www.forestryforum.com/board/index.php?PHPSESSID=4db861b1cb6e82ea8ce8284d16465bfa&thememode=mobile;redirect=http%3A%2F%2Fuwall.tv%2Fredir.php%3Fw%3D800%26url%3Dhttp%3A%2F%2Fwww.kookshopdepepermolen.nl%2Fblog%2Fperfecte-kopje-thee-solis-waterkoker%2F
200 http://eduraft.com/common/login/registeruser.php?redirecturl=http://www.ccjpoz.org/libraries/main/exlink.php?url=www.kookshopdepepermolen.nl/blog/perfecte-kopje-thee-solis-waterkoker/
200 http://cloud.itsc.cuhk.edu.hk/redirection/redirect.aspx?URL=http://open-search.eu/recent.php?lang=at&q=www.kookshopdepepermolen.nl/blog/perfecte-kopje-thee-solis-waterkoker/
@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 / 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 / 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
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 / 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/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);