This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*- | |
# ex: ts=8 sw=8 noet filetype=sh | |
# MCollective's mco completion by Krzysztof Wilczynski <[email protected]> | |
_mco() | |
{ | |
local current | |
COMPREPLY=() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following monstrosity ... | |
class test { } | |
define test::a($array) { | |
test::iterator { $name: | |
array => $array | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following monstrosity ... | |
define partitions { | |
$fact = "partitions_${name}" | |
$result = split(inline_template("<%= scope.lookupvar(fact) %>"), ',') | |
notice $result | |
partition { $result: } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
krzysztof@samsung ~/Sandbox $ cat - | LOAD_PATH=. FACTERLIB=. puppet | |
define iterator { | |
notice $name | |
} | |
$array = ['a', 'b', 'c'] | |
$result = split(join($array, ',', 'letter_'), ',') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
krzysztof@samsung ~/Sandbox $ cat - | LOAD_PATH=. FACTERLIB=. puppet | |
define iterator { | |
notice $name | |
} | |
$array = ['a', 'b', 'c', 'd'] | |
$result = collect_indices($array, 1, 3, 2, 10) | |
notice $result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/usr/bin/env ruby | |
PROC_NET_TCP = '/proc/net/tcp' # This should always be the same ... | |
TCP_STATES = { '00' => 'UNKNOWN', # Bad state ... Impossible to achieve ... | |
'FF' => 'UNKNOWN', # Bad state ... Impossible to achieve ... | |
'01' => 'ESTABLISHED', | |
'02' => 'SYN_SENT', | |
'03' => 'SYN_RECV', | |
'04' => 'FIN_WAIT1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[krzysztof@development ~]$ cat - | puppet | |
$a = ['a', 'b'] | |
notice inline_template("<%= a[0] %>") | |
notice: Scope(Class[main]): a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[krzysztof@development tmp]$ cat test.erb | |
<%= a[0] %> | |
[krzysztof@development tmp]$ cat test.pp | |
class test { | |
$a = ['a', 'b'] | |
file { "/tmp/test": | |
content => template("/tmp/test.erb"), | |
ensure => present, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matti@acrux ~ $ cat - | puppet | |
$a = [ 'a', 'b', 'c' ] | |
define iterator { notice $name } | |
iterator { $a:; } | |
notice: Scope(Iterator[a]): a | |
notice: Scope(Iterator[b]): b | |
notice: Scope(Iterator[c]): c | |
matti@acrux ~ $ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$customers = array('hennie' => 100, 'krzysztof' => 10); | |
$customer = $_GET['customer']; | |
if (! $customer) | |
{ | |
echo 'You have to specify a customer name in order to access its balance details'; | |
exit(1); |