Skip to content

Instantly share code, notes, and snippets.

View pbull's full-sized avatar

Peter Bull pbull

  • Acquia
  • Arlington, MA
View GitHub Profile
diff --git a/utf8mb4_convert.drush.inc b/utf8mb4_convert.drush.inc
index de647d0..9a0e66a 100644
--- a/utf8mb4_convert.drush.inc
+++ b/utf8mb4_convert.drush.inc
@@ -225,16 +225,25 @@ function utf8mb4_convert_drush_command() {
$items['utf8mb4-convert-databases'] = array(
'description' => "Converts all databases defined in settings.php to utf8mb4.",
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
+ 'arguments' => array(
+ 'connections' => 'A space separated list of connections. Default is default connection.',
@pbull
pbull / .htaccess
Created February 11, 2015 13:26
Restrict access to Acquia non-prod environment by IP.
# Whitelisted IPs (or regex matching IP ranges).
# If the client IP matches any of the whitelisted
# IPs the "allowed-ip" var is set.
#
SetEnvIf AH_Client_IP 12.34.56.78 allowed-ip
SetEnvIf AH_Client_IP 23.45.67.89 allowed-ip
SetEnvIf AH_Client_IP 34.56.78.90 allowed-ip
# This section should be added near the top of the
@pbull
pbull / .bashrc
Created November 7, 2014 20:51
Specify Acquia environment in your bash prompt.
# Specify Acquia environment in your bash prompt.
PS0=$PS1
if [ "$AH_SITE_ENVIRONMENT" = "prod" ]; then
ENV_COLOR="\[\033[30;41m\]"
elif [ "$AH_SITE_ENVIRONMENT" = "test" ]; then
ENV_COLOR="\[\033[30;43m\]"
else
ENV_COLOR="\[\033[30;42m\]"
fi
PS1="${ENV_COLOR}[ env: ${AH_SITE_ENVIRONMENT} ]\[\033[00m\] ${PS0}"
@pbull
pbull / segfault.php
Last active August 29, 2015 14:08
This code will segfault php 5.5 (for testing/debugging purposes)
<?php
$contents = '/*' . str_repeat('a', 60000) . '*/ Test1';
$contents = preg_replace('<
\s*([@{}:;,]|\)\s|\s\()\s* | # Remove whitespace around separators, but keep space around parentheses.
/\*([^*\\\\]|\*(?!/))+\*/ | # Remove comments that are not CSS hacks.
[\n\r] # Remove line breaks.
>x', '\1', $contents);
print $contents;
@pbull
pbull / drupal7.32_sql_injection_test.php
Created October 18, 2014 02:10
Test that a Drupal 7 site has been correctly patched for CVE-2014-3704.
<?php
/**
* Run this script using drush php-script (scr) to test whether a site has been
* patched for CVE-2014-3704.
*/
// Attempt SQL injection and verify that it does not work.
$condition = array(
"1 ;CREATE TABLE {xCVE20143704} (c varchar(10)); INSERT INTO {xCVE20143704} SET c = 'owned'; -- " => '',
'1' => '',
@pbull
pbull / mailFilters.xml
Created September 24, 2014 11:06
Arlington List Gmail Filter
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='to' value='arlington@arlingtonlist.org'/>
<apps:property name='subject' value='[arlington]'/>
<apps:property name='label' value='ArlingtonList'/>
<apps:property name='shouldArchive' value='true'/>
@pbull
pbull / .htaccess
Created June 11, 2014 17:42
Rewrite requests to production server for localhost install.
### Apache Rewrite
# Force image styles that have local files that exist to be generated.
RewriteCond %{REQUEST_URI} ^/sites/([^\/]*)/files/styles/[^\/]*/public/((.*))$
RewriteCond %{DOCUMENT_ROOT}/sites/%1/files/%2 -f
RewriteRule ^(.*)$ $1 [QSA,L]
# Otherwise, send anything else that's in the files directory to the
# production server.
RewriteCond %{REQUEST_URI} ^/sites/[^\/]*/files/.*$
RewriteCond %{REQUEST_URI} !^/sites/[^\/]*/files/css/.*$