Skip to content

Instantly share code, notes, and snippets.

@arnobroekhof
arnobroekhof / standalone.xml
Last active January 4, 2016 01:19
PicketLink IDP Ldap settings
<security-domain name="idp" cache-type="default">
<authentication>
<login-module code="org.jboss.security.auth.spi.LdapExtLoginModule" flag="required">
<module-option name="java.naming.provider.url" value="ldap://localhost:389"/>
<module-option name="java.naming.security.authentication" value="simple"/>
<module-option name="bindDN" value="cn=XXXXX"/>
<module-option name="bindCredential" value="XXXXXX"/>
<module-option name="baseCtxDN" value="ou=People,dc=XXXXX,dc=XXX"/>
<module-option name="baseFilter" value="(uid={0})"/>
<module-option name="rolesCtxDN" value="ou=groups,dc=XXXXX,dc=XXX"/>
@arnobroekhof
arnobroekhof / parse_logfile
Created February 4, 2014 22:29
Parsing log file
#!/usr/bin/env python
#
# log_format traffic '$http_host|$status|$bytes_sent|$msec|$remote_addr|$request_uri';
import sys
import itertools, operator
from datetime import datetime
access_log = '/var/log/nginx/access.log'
@arnobroekhof
arnobroekhof / pre-commit
Last active July 31, 2024 14:52
Maven pre commit hook
#!/bin/bash
# save the file as <git_directory>/.git/hooks/pre-commit
echo "Running Maven clean test for errors"
# retrieving current working directory
CWD=`pwd`
MAIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# go to main project dir
cd $MAIN_DIR/../../
@arnobroekhof
arnobroekhof / tar2rpm
Last active October 11, 2023 08:34
Script for converting tar.gz files to rpm
#!/bin/bash
ARCH=''
DESCRIPTION=''
GROUP='Applications'
LICENSE='Restricted'
NAME=''
PRINTSPEC=false
RELEASE=$(date +%Y.%m.%d+%S)
SUMMARY=''
public abstract class Memory {
private static Runtime runtime = Runtime.getRuntime();
private static int mb = 1024*1024;
public static long getFree() {
return runtime.freeMemory() / mb;
}
package nl.techop.AccountControl.utils
/**
* @author arnobroekhof
*
*/
class FileContentUtils {
/**
* Return the content of the given file
log4j.rootLogger=WARN, syslog
log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.facility=LOCAL0
log4j.appender.syslog.layout.ConversionPattern=%-5p [%t] [%c]: %m%n
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.SyslogHost=my.syslog.server.fqdn
@arnobroekhof
arnobroekhof / bamboo
Created March 19, 2015 20:18
Bamboo upstart ( init ) script
# description "start and stop the bamboo-agent"
#
start on runlevel [2345]
stop on runlevel [^2345]
console log
chdir /opt/bamboo
setuid bamboo
setgid bamboo
@arnobroekhof
arnobroekhof / vba
Created April 4, 2015 10:42
Excel password cracker
Sub PasswordBreaker()
'Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
#!/usr/bin/env python
import ldap
import os, sys
import ConfigParser
import logging
config_file = '/etc/sysconfig/ssh-ldap'
def parse_config(config_file):