Skip to content

Instantly share code, notes, and snippets.

@yazzou
yazzou / nginx_wp_include.conf
Created April 24, 2022 15:38 — forked from BrianGilbert/nginx_wp_include.conf
Create it as: /var/aegir/config/includes/nginx_wp_include.conf and add it in your custom vhost eg. https://gist.github.com/BrianGilbert/6227181
#######################################################
### nginx.conf site wp vhost include start
#######################################################
###
### deny crawlers without 403 response
###
if ($http_user_agent ~* (HTTrack|HTMLParser|libwww|wget) ) {
return 444;
}
@yazzou
yazzou / wordpress-vhost.conf
Created April 24, 2022 15:38 — forked from BrianGilbert/wordpress-vhost.conf
Example wordpress vhost for aegir box, also see https://gist.github.com/BrianGilbert/6227135
server {
include /var/aegir/config/includes/fastcgi_params.conf;
limit_conn gulag 32; # like mod_evasive - this allows max 32 simultaneous connections from one IP address
listen *:80;
server_name wordpress.domain.name;
root /var/www/siteroot;
# Extra configuration from modules:
include /var/aegir/config/includes/nginx_wp_include.conf;
}
@yazzou
yazzou / drupal_8_twig_cheatsheet.md
Created March 21, 2022 10:16 — forked from raphaellarrinaga/drupal_8_twig_cheatsheet.md
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Please note I created that sheet as a personal side note/draft and not everything is fully tested. There could be errors or better things to do. So if you spot something wrong or something that can be improved, feel free to comment below and I will do the changes.

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

@yazzou
yazzou / google_maps_scraping_selenium.py
Created November 2, 2021 09:40 — forked from lobstrio/google_maps_scraping_selenium.py
Collect all data from a Search URL on Google Maps 👋
# _*_ coding: utf-8 _*°
# Copyright(C) 2021 lobstr
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
import time
import csv
@yazzou
yazzou / git-command.md
Created October 27, 2021 06:38 — forked from aquelito/git-command.md
GIT - Ligne de commande principale
title category
Git config
Git

Rappel

Ne pas oublier : l'aide en ligne de commande.

@yazzou
yazzou / install-wp-plugins.php
Created May 21, 2021 20:30 — forked from hansschuijff/install-wp-plugins.php
Programmatically install and activate wordpress plugins
<?php
/**
* Plugin Name: Activate required plugins.
* Description: Programmatically install and activate plugins based on a runtime config.
* Version: 1.0
* Author: Hans Schuijff
* Author URI: http://dewitteprins.nl
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
@yazzou
yazzou / sendgrid.bash
Created April 10, 2021 06:31 — forked from velizarn/sendgrid.bash
Send email from bash script by using SendGrid API
#!/bin/bash
SENDGRID_API_KEY=""
EMAIL_TO=""
FROM_EMAIL=""
FROM_NAME=""
SUBJECT=""
bodyHTML="<p>Email body goes here</p>"
@yazzou
yazzou / cloudflare-ddns-update.sh
Created March 6, 2021 06:01 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@yazzou
yazzou / gist:c113b93c1a3d8ce646721bc9471a8676
Created February 22, 2021 05:02 — forked from mannieschumpert/gist:8888351
Some filter examples for preventing editing of certain users.
<?php
/**
* Prevent Editing of a specified user
*
* This example shows how you can protect the original admin from being edited or deleted by anyone else
*/
add_filter('map_meta_cap', 'prevent_user_edit', 10, 4 );
function prevent_user_edit( $required_caps, $cap, $user_id, $args ){
$protected_user = 1; // ID of user not editable
@yazzou
yazzou / sed 101
Created February 11, 2021 12:33 — forked from worker8/sed 101
Useful sed regex collection
http://sed.sourceforge.net/sed1line.txt
-------------------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005
Compiled by Eric Pement - pemente[at]northpark[dot]edu version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt