Skip to content

Instantly share code, notes, and snippets.

View AronNovak's full-sized avatar

Aron Novak AronNovak

View GitHub Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListAccessPointsForObjectLambda",
"s3:GetAccessPoint",
"s3:PutAccountPublicAccessBlock",
@AronNovak
AronNovak / nginx-azure-web-apps.conf
Created June 16, 2023 04:23
Ngnix config for Azure Web Apps + Drupal 9 site
server {
#proxy_cache cache;
#proxy_cache_valid 200 1s;
listen 8080;
listen [::]:8080;
root /home/site/wwwroot/web;
index index.php index.html index.htm;
server_name example.com www.example.com;
port_in_redirect off;
@AronNovak
AronNovak / Hierarchical book structure - Drupal 9 sample.php
Last active December 12, 2022 14:26
Programmatic hierarchical book structure
<?php
// Create seven nodes, put them in a book tree structure.
// A
// |- B
// | |- C
// | |- D
// |- E
// |- F
// |- G
@AronNovak
AronNovak / entityreference-devel-generate-speedup.patch
Created August 22, 2022 12:48
Drupal 7 EntityReference Devel Generate speedup
diff --git a/entityreference.devel_generate.inc b/entityreference.devel_generate.inc
index fab46dd..d6d7d78 100644
--- a/entityreference.devel_generate.inc
+++ b/entityreference.devel_generate.inc
@@ -15,18 +15,20 @@ function entityreference_devel_generate($object, $field, $instance, $bundle) {
}
function _entityreference_devel_generate($object, $field, $instance, $bundle) {
- $object_field = array();
- // Get all the entity that are referencable here.
@AronNovak
AronNovak / file_cleanup.php
Created February 21, 2022 09:07
Drupal 9 - unused / unmanaged unsupervised file cleanup script.
<?php
/**
* @file
* File cleanup script, to be executed after the migration.
*
* Invocation:
* ddev drush scr web/modules/custom/server_migrate/file_cleanup.php .
*/
@AronNovak
AronNovak / markdown-to-email
Last active December 3, 2021 10:13 — forked from rtulke/markdown-to-email
markdown-to-emailA simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself. With added table support.
#!/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 <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---
@AronNovak
AronNovak / memory_low_alert2slack.sh
Created December 3, 2020 09:54
Memory low alert2slack
#!/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
@AronNovak
AronNovak / disk_used_alert2slack
Last active December 3, 2020 09:27 — forked from AAber/disk_used_alert2slack
Script to monitor disk space and alert via slack when disk usage is > 80% Place the script in /etc/cron.hourly
#!/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
@AronNovak
AronNovak / RoboFile.php
Created August 5, 2020 11:55
Local Robo instance boostrapping
<?php
use Robo\Tasks;
/**
* Setup an ElasticSearch server locally.
*/
class RoboFile extends Tasks {
const ES_VERSION = '7.5.2';
@AronNovak
AronNovak / RoboFile.php
Last active January 21, 2022 13:07
RoboFile with Drupal 8 / 9 bootstrapped inside
<?php
use Robo\Tasks;
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
$GLOBALS['drupal_autoloader'] = require_once 'web/autoload.php';
/**