`php working
mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1
| import asyncio | |
| import base64 | |
| import json | |
| import os | |
| import pyaudio | |
| from websockets.asyncio.client import connect | |
| class SimpleGeminiVoice: | |
| def __init__(self): |
| ____Artists____,,,, | |
| Aaron Horkey,"style of Aaron Horkey","" | |
| Abbott Handerson Thayer,"style of Abbott Handerson Thayer","" | |
| Abigail Larson,"style of Abigail Larson","" | |
| Adam Hughes,"style of Adam Hughes","" | |
| Adrian Ghenie,"style of Adrian Ghenie","" | |
| Adrian Tomine,"style of Adrian Tomine","" | |
| Adrianus Eversen,"style of Adrianus Eversen","" | |
| Agnes Cecile,"style of Agnes Cecile","" | |
| Agostino Arrivabene,"style of Agostino Arrivabene","" |
`php working
mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1
| <?php | |
| // The drupal_set_message() function is being deprecated! | |
| // @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x | |
| // > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. | |
| // > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. | |
| // In some custom code. | |
| \Drupal::messenger()->addMessage('Say something else'); |
| # SPECIFIC: Block #submit #validate #process #pre_render #post_render #element_validate #after_build #value_callback parameters | |
| SecRule REQUEST_FILENAME "(index\.php|\/$)" "chain,id:003294,t:lowercase,t:none,t:utf8toUnicode,t:urlDecodeUni,t:urldecode,block" | |
| SecRule REQUEST_METHOD "^(GET|POST|HEAD)$" chain | |
| SecRule ARGS_NAMES|REQUEST_COOKIES_NAMES "^\#(submit|validate|pre_render|post_render|element_validate|after_build|value_callback|process)$|\[(?:\'|\")?#(submit|validate|pre_render|post_render|element_validate|after_build|value_callback|process)" | |
| # GENERIC: Block all parameters starting with # | |
| SecRule REQUEST_FILENAME "(index\.php|\/$)" "chain,id:003309,t:lowercase,t:none,t:utf8toUnicode,t:urlDecodeUni,t:urldecode,block" | |
| SecRule REQUEST_METHOD "^(GET|POST|HEAD)$" chain |
| <?php | |
| function module_query_views_events_alter(Drupal\Core\Database\Query\AlterableInterface $query){ | |
| // If this the right query | |
| if( | |
| $query->getMetaData('view') != '' | |
| && $query->getMetaData('view')->getDisplay()->display['id'] == 'block_3' | |
| ){ |
| /** | |
| * @file | |
| * Example code from http://agaric.com/blogs/conditional-fields-paragraphs-using-javascript-states-api-drupal-8. | |
| */ | |
| /** | |
| * Implements hook_field_widget_WIDGET_TYPE_form_alter(). | |
| * | |
| * Example of conditional fields in paragraphs for Drupal 8. | |
| */ |
See https://www.nginx.com/resources/wiki/start/topics/tutorials/install/#official-debian-ubuntu-packages on how to install the lastest version of nginx.
Most settings are sourced from https://bettercrypto.org/static/applied-crypto-hardening.pdf#subsection.2.1.3, https://danpalmer.me/blog/ssl-labs-grade-a, https://gist.github.com/plentz/6737338 and https://scotthelme.co.uk/
| <?php | |
| use Drupal\file\Entity\File; | |
| use Drupal\image\Entity\ImageStyle; | |
| // File ID. | |
| $fid = 123; | |
| // Load file. | |
| $file = File::load($fid); | |
| // Get origin image URI. | |
| $image_uri = $file->getFileUri(); | |
| // Load image style "thumbnail". |
| <?php | |
| $path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias'); | |
| if(preg_match('/node\/(\d+)/', $path, $matches)) { | |
| $node = \Drupal\node\Entity\Node::load($matches[1]); | |
| } |