Skip to content

Instantly share code, notes, and snippets.

View wgroenewold's full-sized avatar

Wouter Groenewold wgroenewold

  • GH+O Communicatie
View GitHub Profile
@wgroenewold
wgroenewold / tutorial.md
Last active October 11, 2019 06:15
Use Azure AD Connect to do SSO on your Nextcloud instance

Do your usual Microsoft Azure AD Connect Application mumbo-jumbo to create a new application.

My config looks like this, use it as inspiration:

{
  "appId": "********-****-****-****-*************",
  "appRoles": [],
  "availableToOtherTenants": false,
  "displayName": "Nextcloud",
@wgroenewold
wgroenewold / Topicus Keyhub webhooks to Slack
Last active August 7, 2018 06:44
Topicus Keyhub webhooks to Slack
<?php
/**
* Class keyhub. Houses everything to bind to Keyhub.
*/
class glue_keyhub{
private $slack_appurl;
/**
<?php
$body =
'<!--[if gte mso 9]>
<img src="cid:logo" width="300" height="400" />
<![endif]-->
<img style="mso-hide:all;" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAetc." />';
$file = __DIR__ . '/btn1.png';
$uid = 'logo';
@wgroenewold
wgroenewold / Install Macbook
Created February 12, 2018 11:25
Automate all the things!!111
#!/bin/bash
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew cask install google-chrome
brew cask install slack
brew cask install microsoft-office
brew cask install adobe-creative-cloud
@wgroenewold
wgroenewold / redirection_assitant.php
Created November 15, 2017 14:56
Create redirects for deleted posts to the appropriate places.
<?php
/*
Plugin Name: Redirection Anti-404-Assistent
Version: 1.0
Plugin URI: http://gho.nl
Author: Wouter Groenewold (GH+O)
Author URI: -
Description: Creates redirects for deleted posts to the right path.
License: Proprietary
@wgroenewold
wgroenewold / brute_force_notice_ip.sh
Last active March 14, 2017 16:08
Auto block IPs - /usr/local/directadmin/scripts/custom/brute_force_notice_ip.sh
#!/bin/sh
if ! [ -z "$value" ] && [ $value =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]; then
found=`iptables -L INPUT -v -n | grep "$value"`
if [ "$count" > 100 ] && [ -z "$found" ]; then
iptables -I INPUT 10 -s $value -j DROP
iptables-save > /etc/iptables.local
fi
fi
exit;
@wgroenewold
wgroenewold / httpd.conf
Created January 25, 2017 15:09
Changes to make httpd pleasant in XAMPP
#line 173
#User daemon
User your_osx_username
#line 230
#DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
#<Directory "/Applications/XAMPP/xamppfiles/htdocs">
DocumentRoot "/Users/your_osx_username/Desktop/www"
<Directory "/Users/your_osx_username/Desktop/www">
@wgroenewold
wgroenewold / gist:1672bd6ac6559bbdc7489cc73e4acd93
Created November 14, 2016 09:29
Filter the title for WP Nested Pages
add_filter('the_title', 'edit_np_title', 10, 3);
function edit_np_title($title, $id, $view = 'nestedpages_title'){
if(is_admin() && isset($_GET['page']) && $_GET['page'] == 'nestedpages-posttype'){
$prefix = 'prefix';
if($prefix){
$title = '[' . $prefix . '] ' . $title;
}
}
Mail forwarder aanmaken op srv2
===============================
$ nano /etc/postfix/main.cf
Voeg aan virtual_alias_domains je domein toe. Syntax:
virtual_alias_domains = domain.com anotherdomain.com yetanotherdomain.com
$ nano /etc/postfix/virtual
Voeg emailadres forwarder toe. Syntax:
from@domain.com to@anotherdomain.com
@wgroenewold
wgroenewold / Force all traffic for Wordpress over SSL
Last active February 8, 2024 10:51
Force all traffic for Wordpress over SSL
define('FORCE_SSL_ADMIN', true);
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['HTTPS']='on';
}