Skip to content

Instantly share code, notes, and snippets.

@arnobroekhof
arnobroekhof / portal_normal.vm
Created October 25, 2011 13:17
Enable dockbar for admins
#if($is_signed_in && $permissionChecker.isCommunityAdmin($group_id))
#dockbar()
#end
@arnobroekhof
arnobroekhof / transfer.sh
Created May 29, 2012 21:49
ftp with exit status
#!/bin/sh
/usr/bin/ftp -iv centos << EOF 2> ftp.error
binary
put testfile
quit
EOF
test -s ftp.error && echo "FTP failed" && exit 1 || rm -f ftp.error
@arnobroekhof
arnobroekhof / netinstall.pp
Created September 3, 2012 09:42
puppi netinstall extract command
$real_extract_command = $extract_command ? {
'' => $source_filetype ? {
'.tgz' => 'tar -zxf',
'.tar.gz' => 'tar -zxf',
'.gz' => 'tar -zxf',
'.tar.bz2' => 'tar -jxf',
'.tar' => 'tar -xf',
'.zip' => 'unzip',
},
@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