This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://pantheon.io/docs/client-ip/ | |
$remote_ip = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drush sql-dump --tables-list=`drush sqlq "show tables like '_raw_%'" | xargs | sed -e 's/ /,/g'` > /tmp/only_users.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$capital_names = [ | |
'Kabul', | |
'Tirana', | |
'Algiers', | |
'Andorra la Vella', | |
'Luanda', | |
'Saint John\'s', | |
'Buenos Aires', | |
'Yerevan', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/includes/environment.inc b/includes/environment.inc | |
index a4717048..a2416424 100644 | |
--- a/includes/environment.inc | |
+++ b/includes/environment.inc | |
@@ -18,7 +18,7 @@ use Webmozart\PathUtil\Path; | |
* Log PHP errors to the Drush log. This is in effect until Drupal's error | |
* handler takes over. | |
*/ | |
-function drush_error_handler($errno, $message, $filename, $line, $context) { | |
+function drush_error_handler($errno, $message, $filename = NULL, $line = NULL, $context = NULL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Robo\Tasks; | |
use Drupal\Core\DrupalKernel; | |
use Symfony\Component\HttpFoundation\Request; | |
$GLOBALS['drupal_autoloader'] = require_once 'web/autoload.php'; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Robo\Tasks; | |
/** | |
* Setup an ElasticSearch server locally. | |
*/ | |
class RoboFile extends Tasks { | |
const ES_VERSION = '7.5.2'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Parse df selected output | |
df -h|egrep -v 'File|tmpfs|docker|udev|snap|loop'| \ | |
while read LINE; do | |
USED_NUMBER=`echo $LINE |awk '{print $5}'|sed 's/\%//'|sed 's/ //g'` | |
USED_PERCENT=`echo $LINE |awk '{print $5}'|sed 's/ //g'` | |
MOUNT_POINT=`echo $LINE |awk '{print $6}'|sed 's/ //g'` | |
if [ $USED_NUMBER -gt 80 ]; then | |
# Create message without spaces |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LANG=C | |
MINIMUM_REQUIRED_MEM=256 | |
FREE_MEM=$(free -mt | awk '/Total/{print $4}') | |
if [ $FREE_MEM -lt $MINIMUM_REQUIRED_MEM ]; then | |
TOP_PROCESS=$(ps aux --sort rss | tail -n1) | |
MESSAGE=$(echo "WARNING On $HOSTNAME, memory usage is low: $TOP_PROCESS WARNING" | sed 's/ /_/g') | |
# Post message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Send an multipart email with HTML and plain text alternatives. The message | |
should be constructed as a plain-text file of the following format: | |
From: Your Name <[email protected]> | |
To: Recipient One <[email protected]> | |
Subject: Your subject line | |
--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* File cleanup script, to be executed after the migration. | |
* | |
* Invocation: | |
* ddev drush scr web/modules/custom/server_migrate/file_cleanup.php . | |
*/ |
OlderNewer