Skip to content

Instantly share code, notes, and snippets.

@arnobroekhof
arnobroekhof / manage.php
Created October 21, 2012 21:20
Using Nginx as a development server for symphony, this is a php (cli) script which configurate and launch Nginx in a directory, the result is similar to django development server.
#!/usr/bin/php
<?php
// by Jean-Bernard Addor 2011
if (1 != assert_options(ASSERT_ACTIVE) or 1 != assert_options(ASSERT_WARNING)):
trigger_error('Assertion ignored');
endif;
$return_var = 0;
echo passthru('mkdir --parents '.'/tmp'.getcwd(), $return_var);
@arnobroekhof
arnobroekhof / sha2-ldap.ldif
Created January 10, 2013 10:42
openldap add sha2-ldap --> load it with ldapadd -Y EXTERNAL -H ldapi:/// -f sha2-ldap.ldif
dn: cn=module{1},cn=config
objectClass: olcModuleList
cn: module{1}
olcModulePath: /usr/lib64/openldap
olcModuleLoad: slapd-sha2
@arnobroekhof
arnobroekhof / str2sha512password.rb
Created March 18, 2013 21:24
str2sha512password This is a puppet function that converts a string to a salted-SHA512 password hash for linux and unix systems given any simple string, you will get a sha512 hash that can be insert directly into the shadow file.
#
# str2sha512password.rb
#
module Puppet::Parser::Functions
newfunction(:str2sha512password, :type => :rvalue, :doc => <<-EOS
This converts a string to a salted-SHA512 password hash for linux and unix systems
given any simple string, you will get a sha512 hash that can be insert directly into
the shadow file.
EOS
@arnobroekhof
arnobroekhof / generatepassword.rb
Created March 18, 2013 22:42
Generate and email a new password with puppet
#
# generatepassword.rb
#
module Puppet::Parser::Functions
newfunction(:generatepassword, :type => :rvalue, :doc => <<-EOS
This converts a string to a salted-SHA512 password hash for linux and unix systems
given any simple string, you will get a sha512 hash that can be insert directly into
the shadow file.
EOS
@arnobroekhof
arnobroekhof / activemq.xml.erb
Created April 8, 2013 20:19
activemq.xml.erb --> mcollective
<plugins>
<statisticsBrokerPlugin/>
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="mcollective" password="marionette" groups="mcollective,everyone"/>
<authenticationUser username="admin" password="secret" groups="mcollective,admin,everyone"/>
</users>
</simpleAuthenticationPlugin>
<authorizationPlugin>
<map>
@arnobroekhof
arnobroekhof / gist:5348563
Last active December 16, 2015 00:38
create iscsi mount
iscsid.conf
node.startup = automatic
#set chap names
iscsiadm -m discovery -t sendtargets -p <ip>:<port> -n node.startup -v automatic
# show for verification
@arnobroekhof
arnobroekhof / puppet-fstab-convert.sh
Last active December 16, 2015 07:39
Converts the fstab of a linux to a puppet config file
#!/bin/sh
FILE=$1
if [ -z $1 ]
then
echo "No file given"
exit 1
fi
@arnobroekhof
arnobroekhof / facter-rest
Last active December 23, 2015 22:59
simple rest api for printing all facts from facter in json format.
#!/usr/bin/env ruby
require 'facter'
require 'json'
require 'sinatra'
ipaddress="172.16.132.2"
# sinatra specific settings
set :sessions, false
# Client
/opt/scc/bin/scc –v <host> -e “* “ –p cp –s \ /var/opt/scc/data/transfer
#Server
/opt/scc-srv/bin/scc-pull –n -L /var/opt/scc-srv/conf/scc-pull-list
@arnobroekhof
arnobroekhof / pre-commit
Created October 15, 2013 20:38
puppet-pre-commit
#!/bin/bash
# pre-commit git hook to check the validity of a puppet manifest
#
# Prerequisites:
# gem install puppet-lint puppet
#
# Install:
# /path/to/repo/.git/hooks/pre-comit
# Source RVM if needed