Skip to content

Instantly share code, notes, and snippets.

View TrafeX's full-sized avatar

Tim de Pater TrafeX

View GitHub Profile
def v2_playbook_on_play_start(self, play):
hosts = play.get_variable_manager()._inventory.get_hosts()
for host in hosts:
pprint(host.get_group_vars()['applicaton.deploy_env'])
pprint(host.get_group_vars())
pprint(host.get_vars())
@TrafeX
TrafeX / wp-lambda-cronjob.py
Created January 10, 2017 14:17
WordPress Lambda Cronjob
import urllib2
def lambda_handler(event, context):
req = urllib2.Request('https://www.thewebsite.nl/wp/wp-cron.php?doing_wp_cron', headers={'User-Agent' : "AWS Lambda Cron"})
con = urllib2.urlopen(req)
print con.read()
@TrafeX
TrafeX / caching.conf
Last active March 20, 2024 08:47
Nginx Wordpress caching
# The path to store the cache files, limit the folder to 100MB
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m;
# A unique request is defined by this cache key
fastcgi_cache_key "$scheme$request_method$host$request_uri";
# Show the cached version if upstream gives a timeout or a HTTP 500 error
fastcgi_cache_use_stale error timeout invalid_header http_500;
# Don't use the following headers to define the cache variables
@TrafeX
TrafeX / logstash.conf
Created March 1, 2014 16:41
Logstash configuration for import bank transactions
input {
file {
path => ["bank/*.csv"]
start_position => "beginning"
}
}
filter {
csv {
columns => ['date', 'name', 'account', 'contra-account', 'code', 'increasedecrease', 'amount', 'category', 'description']
}
@TrafeX
TrafeX / composer.json
Created June 21, 2013 07:13
composer.json and composer.lock that's causing a segfault when running composer update.
{
"name": "..",
"description": "..",
"autoload": {
"psr-0": {
"At": "library/",
"Glitch": "library/",
"Zend": "library/",
"" : "application/modules/"
},
@TrafeX
TrafeX / Segfault
Last active December 17, 2015 22:39
This causes a segmentation fault in PHP 5.4.11
<?php
class example
{
private $instance;
public function getInstance()
{
// Lazy load the instance
if (null === $this->instance) {
$this->instance = new example();
@TrafeX
TrafeX / gist:3705623
Created September 12, 2012 09:50
Parallel-ssh tail
parallel-ssh -t -1 -P -v -H server1 -H server2 tail -f /var/log/httpd/\*
@TrafeX
TrafeX / benchmark.sh
Created February 21, 2012 12:32
ZF benchmarks
#!/bin/bash
concurrent=5
max=81
while [ $concurrent -lt $max ]
do
ab_args='-n 2000 -c '$concurrent
folder='run-'`date +'%Y%m%d%H%M%S'`'-'$concurrent
@TrafeX
TrafeX / memcacheq-add.php
Created December 29, 2010 08:57
An example how to use memcacheq with Zend_Queue
<?php
// MemcacheQ config
$queueOptions = array(
'name' => 'example-queue',
'driverOptions' => array(
'host' => '127.0.0.1',
'port' => 22201
)
);