Skip to content

Instantly share code, notes, and snippets.

@eguicciardi
eguicciardi / drupal_batch_drush_example.php
Last active November 2, 2020 02:17
Drupal 7.x Batch API example tied with a Drush command
<?php
function mymodule_setup_batch($start=1, $stop=100000) {
$dataset = array(); // A very large dataset
$chunks = array_chunk($dataset, 20); // Divide the dataset
$operations = array();
$count_chunks = count($chunks);
$i = 1;
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active June 26, 2024 07:47
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
@sergejmueller
sergejmueller / nginx.conf
Last active August 18, 2022 08:44
Stop search engines from indexing .txt, .log, .xml, .css and .js files in Nginx
location ~* \.(txt|log|xml|css|js)$ {
add_header X-Robots-Tag noindex;
}