Skip to content

Instantly share code, notes, and snippets.

View gerard-kanters's full-sized avatar

Gerard Kanters gerard-kanters

View GitHub Profile
@gerard-kanters
gerard-kanters / functions.php
Created January 6, 2021 13:11
Filter for Yoas SEO with Wordpress to index internal search pages. Add this in functions.php of your theme.
//Let Google index search pages, otherwise following links will also stop
function index_search_robots ($robots) {
if ( is_search() ) {
return 'index,follow';
}
return $robots;
}
add_filter( 'wpseo_robots', 'index_search_robots' );
@gerard-kanters
gerard-kanters / stopforumspam.sh
Last active November 11, 2020 12:32
Stop spam with firewalld and ipset. Ipset is very fast and can have hundres of thousands of rules without delaying your site.
#!/bin/bash
# Script downloads monthly spammers and adds them via ipset to firewalld. Add this script in /etc/cron.daily and make it executable (chmod +x /etc/cron.daily/stopforumspam.sh)
#Inital command to create ipset, run once
#ipset create dailyspam hash:ip maxelem 16777216
#Add set to firewalld
#firewall-cmd --permanent --new-ipset=dailyspam --type=hash:ip --option=maxelem=16777216
#firewall-cmd --permanent --add-rich-rule='rule source ipset=dailyspam log prefix="spam" level="debug" limit value="1/h" drop'
@gerard-kanters
gerard-kanters / xenserver-centos7
Last active August 6, 2018 14:27
Increase disk on Xenserver with Centos 7
Bring down the VM with XenCenter
Go to storage and change storage size of the VM in properties. In this case 160GB
Boot VM with XenCenter or #reboot
Change the run level to single user mode
#init 1
Show partitions
#fdisk -l
@gerard-kanters
gerard-kanters / rd-clean.sh
Last active December 12, 2016 15:50 — forked from imatpro/rd-clean.sh
Shell script to purge Rundeck execution history
#!/bin/sh
# keep last 6000 executions for each job, about 1 week if running minute jobs
KEEP=6000
cd /var/lib/rundeck/logs/rundeck
JOBS=`find . -maxdepth 3 -path "*/job/*" -type d`
@gerard-kanters
gerard-kanters / Mautic code
Last active December 11, 2015 21:51
Mautic code for MyVox (you need to extend head in an existing plugin or creat a new plugin)
//Mautic programmatic marketing
$page_url = 'http://' . $_SERVER[HTTP_HOST] . $_SERVER['REQUEST_URI'];
$page_title = urlencode($title);
if(myvox_is_logged_in()) {
$muser = myvox_get_logged_in_user_entity();
$email = urlencode($muser->email);
} else {
$email = "";
}
$src= "http://mautic.netcare.nl/mtracking.gif?page_url='$page_url'&page_title='$page_title'&email='$email'";
@gerard-kanters
gerard-kanters / inactivity.js
Last active March 6, 2024 18:49
Inactivity timeout javascript
<script type="text/javascript">
function idleTimer() {
var t;
//window.onload = resetTimer;
window.onmousemove = resetTimer; // catches mouse movements
window.onmousedown = resetTimer; // catches mouse movements
window.onclick = resetTimer; // catches mouse clicks
window.onscroll = resetTimer; // catches scrolling
window.onkeypress = resetTimer; //catches keyboard actions
@gerard-kanters
gerard-kanters / solr
Created October 15, 2014 15:51
/etc/init.d/solr
#!/bin/bash
# Script for running solr as a service under initd.
#
# Requires solr.conf and solr.start
# Usage: service solr {start|stop|restart|status}"
#
#-----------------------------------------------------
### BEGIN INIT INFO
# Provides: solr
# Required-Start:
@gerard-kanters
gerard-kanters / solr.conf
Last active August 29, 2015 14:07
/etc/solr.conf
#-----------------------------------------------------
# solr-initd v0.5.1
#-----------------------------------------------------
# Configuration for solr.init. Copy this to:
#
# /etc/solr.conf
#
# NOTE: if you are installing this somewhere else then
# you need to alter solr.start and solr.initd.
#
@gerard-kanters
gerard-kanters / solr.start
Created October 15, 2014 15:48
solr.start (put in /var/lib/)
#!/bin/bash
#-----------------------------------------------------
# solr-initd v0.5.1
#-----------------------------------------------------
# Starts solr and writes a pid file. Meant
# to be used with the initd script but this
# can be used on it's own
#
# Requires /etc/solr.conf
# Usage: ./solr.start
@gerard-kanters
gerard-kanters / server.ini
Last active September 18, 2016 12:17
HHVM server ini
;extension = /usr/lib64/php/modules/geoip.so
hhvm.pid_file = "/var/run/hhvm/hhvm.pid"
hhvm.server.port = 9000
hhvm.server.fix_path_info = true
hhvm.server.type = fastcgi
hhvm.server.enable_magic_quotes_gpc = false
hhvm.server.enable_keep_alive = true
hhvm.server.enable_ssl = true
hhvm.log.access_log_default_format = "%h %l %u %t \"%r\" %>s %b"