Skip to content

Instantly share code, notes, and snippets.

@hpbuniat
hpbuniat / gist:1687f594ae10ad669761
Created May 12, 2014
Collect access.log from multiple servers
View gist:1687f594ae10ad669761
. ~/sync-jobs/setup/slaves
if [ ! -f $3 ]; then
cat /dev/null > _collected.log
if [ -z $1 -o -z $2 -o -z $3 ]; then
echo "Usage: $0 date search target"
exit
fi
echo "fetching logs created on $1 with search for $2 to $3"
for slave in ${slaves[@]}
@hpbuniat
hpbuniat / svn-version.php
Last active Dec 15, 2015
Get all versions of a specific file from svn
View svn-version.php
<?php
/**
* SVN-Version extractor of a specific file
*
* Get all versions of a specific file from svn
*/
// argument-handling
$aArgs = getopt('f:p:r:');
$iRevision = (true === empty($aArgs['r'])) ? 'HEAD' : $aArgs['r'];
@hpbuniat
hpbuniat / namespaceRefactor.php
Last active Apr 3, 2021
Super-simple script to convert a existing project to use namespaces
View namespaceRefactor.php
<?php
/**
* Super-simple script to convert a existing project to use namespaces
*
* @author Hans-Peter Buniat <hpbuniat@googlemail.com>
* @copyright 2012 Hans-Peter Buniat <hpbuniat@googlemail.com>
* @license http://opensource.org/licenses/BSD-3-Clause
*/
class namespaceRefactor {
View lottaStats.php
<?php
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__)));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../social/ZF/library'),
get_include_path()
)));
@hpbuniat
hpbuniat / tracAge.php
Created Jun 14, 2012
Read the latest modification date of a number of tracs
View tracAge.php
<?php
/**
* Read the latest modification date of a number of tracs
*/
class tracTest {
/**
* The http-client to use (w/ auth)
*
* @var Zend_Http_Client
@hpbuniat
hpbuniat / xhmem.php
Created May 11, 2012
Find memory intensive functions in a bunch of xhprof-results (e.g. phpunit run with xhprof-listener)
View xhmem.php
<?php
class xhparser {
/**
* Content
*
* @var string
*/
private $_aFiles = array();
@hpbuniat
hpbuniat / iframeclick.html
Created May 7, 2012
Test for tracking clicks within an iframe
View iframeclick.html
<!DOCTYPE html>
<html>
<head>
<meta content="Hans-Peter Buniat" name="author">
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title>test iframe clicks</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var f = {
@hpbuniat
hpbuniat / popunder.html
Created Mar 17, 2012
Popunder working in ff 3-12, chrome 10-18, ie6-9 with cookie support
View popunder.html
<!DOCTYPE html>
<html>
<head>
<meta content="Hans-Peter Buniat" name="author">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Form-Submit Popunder with Cookie support</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<!-- Cookie support -->
<script type="text/javascript" src="https://cookies.googlecode.com/svn/trunk/jaaulde.cookies.js"></script>
View instagram-unshredder.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('max_execution_time', 0);
ini_set('memory_limit', '256M');
/**
* Test for http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder
*
* @author Hans-Peter Buniat
View usort.php
<?php
$aOpts = getopt('i:');
if (empty($aOpts['i']) === true) {
$aOpts = array(
'i' => 10000
);
}
$aValues = range(0, $aOpts['i'], 1);
shuffle($aValues);