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 python | |
import boto3 | |
import json | |
import base64 | |
import requests | |
import os | |
def headers_to_go_style(headers): | |
retval = {} | |
for k, v in headers.items(): |
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
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# Uncomment the following line if you don't like systemctl's auto-paging feature: | |
# export SYSTEMD_PAGER= |
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
{ | |
'string' => 'foo', | |
'array' => [ | |
'one', | |
'two', | |
'three', | |
], | |
'hash' => { | |
'a' => 1, | |
'b' => 2, |
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
function test::merge_env_arrays ( | |
Array $array_one, | |
Array $array_two, | |
) >> Array { | |
$hash_one = $array_one.reduce({}) |$memo, $var| { | |
$v = $var.split('=') | |
merge($memo, { $v[0] => $v[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
class test::mergepaths ( | |
$envpath = undef, | |
) { | |
$_envpath = $envpath ? { | |
undef => $::path, | |
default => join([$envpath, $::path], ':'), | |
} | |
notify { 'newpath': |
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 | |
require 'puppet' | |
require 'json' | |
Puppet.initialize_settings | |
require File.join(Puppet['plugindest'], 'puppet', 'util', 'nc_https.rb') | |
nodename = ARGV[0] | |
raise ArgumentError, 'Please supply a nodename' unless nodename |
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
class_name = 'foo::bar::baz' | |
parts = class_name.split('::') | |
module_name = parts.shift | |
file_name = parts.pop || 'init' | |
subdirs = parts || [] | |
File.join('modules', module_name, 'manifests', *subdirs, "#{file_name}.pp") |
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
[root@node ~]# ./pepper.rb template.erb | |
<%- | String $str_foo, | |
Array $list, | |
Hash $dict, | |
Array $list_2, | |
Hash $list_3, | |
| -%> | |
My IP is <%= $str_foo %>. |
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
[root@puppet2017 ~]# echo -e "/tmp/foo\n/tmp/bar" > /tmp/whitelist | |
[root@puppet2017 ~]# ruby /root/test.rb | |
App_file[/tmp/foo] | |
App_file[/tmp/bar] |
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
# puppet task run facter_task --query 'nodes[certname]{}' fact=datacenter | |
Starting job ... | |
New job ID: 115 | |
Nodes: 2 | |
Started on node1 ... | |
Started on puppet2017.3.0.puppetlabs.vm ... | |
Finished on node node1 | |
status : | |
Finished on node puppet2017.3.0.puppetlabs.vm |