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
| def watch(var1): | |
| """ | |
| Helper to watch the value of VARIABLES (not expressions) | |
| in the scope of calling function: | |
| >>> k = 3 | |
| >>> watch('k') | |
| "k" := int, "3" | |
| Won't work with expressions like: |
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
| package { 'dnsmasq': | |
| ensure => present, | |
| } | |
| $dnsmasq_conf = "no-resolv | |
| server=8.8.4.4 | |
| server=8.8.8.8 | |
| interface=eth0 | |
| no-dhcp-interface=eth0 | |
| no-hosts |
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
| file { '/etc/timezone': | |
| ensure => present, | |
| content => "Europe/Berlin\n", | |
| } | |
| exec { 'reconfigure-tzdata': | |
| user => root, | |
| group => root, | |
| command => '/usr/sbin/dpkg-reconfigure --frontend noninteractive tzdata', | |
| } |
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
| # Invocation example: | |
| # | |
| # $ curl -s "http://169.254.169.254/latest/user-data/" > /tmp/test.yaml | |
| # $ cat /tmp/test.yaml | |
| # instance: | |
| # flavor: application-server | |
| # $ abc=$(cat /tmp/test.yaml | python ec2-user-data-parser.py instance flavor) | |
| # $ echo $abc | |
| # application-server | |
| # $ |
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
| #!/bin/bash | |
| # Determine if cron is running | |
| # Comes from https://gist.github.com/3061023 | |
| UNKNOWN_STATE=3 | |
| CRITICAL_STATE=2 | |
| WARNING_STATE=1 | |
| OK_STATE=0 |
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
| 0 | |
| 01 | |
| 02 | |
| 03 | |
| 1 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 |
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
| #!/bin/bash | |
| # Syntax: create_rabbit_vhost.sh <vhost> <user> <pass> | |
| if [ $# != 3 ]; then | |
| echo "Fail! Syntax: $0 <vhost> <user> <pass>" | |
| exit 1 | |
| fi | |
| rabbitmqctl add_vhost $1 |
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
| -module(bin2dec). | |
| -export([bin2dec/1, bin2dec_/2]). | |
| bin2dec("") -> | |
| 0; | |
| bin2dec(List) -> bin2dec_(List, 0). | |
| bin2dec_([], Sum) -> | |
| Sum; | |
| bin2dec_([48 | Tail], Sum) -> %48 is ascii code for 0 |
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
| 6> c(max). | |
| {ok,max} | |
| 8> max:max([]). | |
| [] | |
| 10> max:max([10]). | |
| 10 | |
| 11> max:max([2, 3, 10]). | |
| 10 | |
| 13> max:max([2, 3, 10, 1]). | |
| 10 |