Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env php
<?php if (PHP_SAPI !== 'cli') die('cli access only');
$host = '127.0.0.1';
$port = mt_rand(31000, 60000);
$dir = locate_webroot();
if (!$dir) {
echo "Error: Could not locate the web root\n";
echo sprintf("Usage: php %s /var/www/html\n", __FILE__);
$build_array_text = function (array $array, $indent = 4, $space = " ", $depth = 0) use (&$build_array_text) {
$string = "array(\n";
$keys = array_keys($array);
$assoc = array_keys(array_fill(0, count($array), null)) !== $keys;
$lastK = $keys[count($array) - 1];
foreach ($array as $k => $v) {
$string .= str_repeat($space, $indent * ($depth + 1)) . ($assoc ? "'$k' => " : "") .
(is_array($v) ? $build_array_text($v, $indent, $space, $depth + 1) :
(is_bool($v) ? ($v ? "true" : "false") :
(is_numeric($v) ? $v : "'" . addslashes($v) . "'"))
<?php return trigger_error('UOPZ IDE helper should not be loaded', E_USER_WARNING);
// The following opcodes are defined as constants by uopz:
/**
* Invoked by exit() and die(), recieves no arguments. Return boolean TRUE to exit, FALSE to continue
*/
define('ZEND_EXIT', 79);
/**
SELECT
c.*,
fk.fk_table_schema,
fk.fk_table_name,
fk.fk_column_name,
fk.constraint_name fk_constraint_name
FROM (
SELECT
table_catalog,
table_schema,
#!/bin/sh
find . -type f | xargs grep -Hno "$@" | grep -E '^\.' | awk -F':' '{print $1, "-L", $2 "," $2}' | xargs -I@ sh -c 'printf "@\t"; git blame --date="short" @' | perl -pe 's/^(.+) -L [^ ]+\t(\w+) \(.+?([0-9-]+).+/$3\t$2\t$1/'
@andrewmackrodt
andrewmackrodt / composer
Created February 14, 2016 22:19
composer-no-xdebug
#!/bin/bash
# copy php ini scan directory entries to the temp folder
PHP_INI_SCAN_DIR=$(php --ini | egrep '^Scan' | perl -pe 's/^.+: //')
PHP_INI_TEMP_DIR=$(mktemp -d)
find "${PHP_INI_SCAN_DIR}" -maxdepth 1 -type l -name '*.ini' -not -name '*xdebug.ini' | xargs -I@ cp @ "${PHP_INI_TEMP_DIR}"
# set the temp folder as the php ini scan directory
export PHP_INI_SCAN_DIR=$PHP_INI_TEMP_DIR
#!/bin/bash
set -eo pipefail
export PHP_OPENSSL_DIR=yes
if [ "$(uname)" == "Darwin" ]; then
PHPBREW_OS_FLAGS=""
PHPBREW_OS_VARIANTS="+pdo"
else
#!/usr/bin/env php
<?php
$args = call_user_func(function () {
preg_match_all(
'/"[^"]+"|\'[^\']+\'|[^ ]+/',
preg_replace_callback(
'/--?([a-z0-9_-]+)(?:[ =]("[^"]*"|\'[^\']*\'|[^ -]+))?/i',
function ($match) use (&$args) {
$k = $match[1];
#!/bin/bash
set -e
JENKINS_PATH=/var/lib/jenkins
JOBS_PATH=$JENKINS_PATH/jobs
WORKSPACE_PATH=$JENKINS_PATH/workspace
MULTI_BRANCH_PROJECTS=$( \
find "$JOBS_PATH" -maxdepth 2 -type f -name 'config.xml' | \
#!/bin/bash
PACKAGE_INSTALL_DATES=$( \
zgrep -h '' /var/log/apt/history.log* \
| perl -0777 -pe 's/\n{2}/\0/g' \
| perl -0777 -pe 's/\n/|/g' \
| perl -0777 -pe 's/\0/\n/g' \
| grep 'Install:' \
| sort -r \
| perl -pe 's/^.*Start-Date: ([^ ]+).*Install: (.+?)\|.+$/\1: \2/' \