Skip to content

Instantly share code, notes, and snippets.

- hosts: all
become: yes
- name: Ensure critical systems are more resilient
dest: "/usr/lib/systemd/system/{{ item }}/reload-on-fail.conf"
content: |
#!/usr/bin/env python3
import argparse
import errno
import os.path
import requests
import sys
from termcolor import colored
parser = argparse.ArgumentParser(description='Check http status code for a list of domains.')
parser.add_argument('-d', '--domain-list', dest='domains_list', help='The list of domains list', required=True)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"|| (echo "Cannot change working directory to $DIR" && exit 1)
if [ "$(readlink "$DIR"/.git/hooks/pre-commit)" = "../../" ]; then
echo "Hook already installed!";
ln -vs ../../ .git/hooks/pre-commit && echo "Installed git-hook succesfully!"
#!/bin/env python
import subprocess
import json
for handler in php_handler_data:
if handler['status'] == 'enabled' and 'x-httpd-lsphp' not in handler['id']:
print handler['id']
nbeernink /
Last active April 3, 2018 12:10
batch migrate mail data via imapsync read from a csv file
#!/usr/bin/env python3
import argparse
import csv
import os
import subprocess
parser = argparse.ArgumentParser(description='Batch migrate e-mail with imapsync reading from a CSV-file')
parser.add_argument('csvfile',help='The CSV file to parse. The file should have a header like this: host1,user1,password1,host2,user2,password2')
parser.add_argument('--dry',action='store_true',help="Use imapsync's dry mode: don't sync, show what would happen")
args = parser.parse_args()

Keybase proof

I hereby claim:

  • I am nbeernink on github.
  • I am nbeernink ( on keybase.
  • I have a public key whose fingerprint is FCDB 3FE6 555F FDB6 3CF8 B221 457E 8D28 82E3 F3DC

To claim this, I am signing this object:

nbeernink /
Last active March 21, 2017 13:23
password protect wp-login to thwart bruteforce attacks
test -e /tmp/found-wp-instances || find /home/ -type f -name "wp-login.php" > /tmp/found-wp-instances
time while read -r wp; do
#Set variables
user=$(echo "$wp"|cut -d/ -f3)
domain=$(echo "$wp"|cut -d/ -f5)
nbeernink /
Last active March 1, 2017 15:03
tries to fix most of plesk users vhost ownership & permissions
#Getting list of users and their home directories from psacln group
awk -F ":" '{print $1, $4, $6}' /etc/passwd | grep "$(getent group psacln|cut -d: -f3)" | awk -F " " '{print $1, $3}' > /root/users_list.txt
time while read -r i
user=$(echo $i | awk '{print $1}')
path=$(echo $i | awk '{print $2}')
echo Fixing ownership and permissions for $user
nbeernink / keyscan
Created March 1, 2017 10:23
Make connecting to huge lists of new hosts easier with this simple ssh hostkey importer (using ssh-keyscan)
if [ -z "${2}" ];then
time while read -r host; do
ip=$(dig +short "$host" 2> /dev/null)
#remove the key from the file
ssh-keygen -R "$host" -f "$outputfile" >/dev/null 2>&1;
nbeernink / gauge-ticket-resolution-past-week.json
Created October 5, 2016 11:03
[cerb] gauge ticket resolutiontime the past week
"label":"Average resolution time past week",
"Within 4 hours",
"within 8 hours",
"More than 24 hours",