Skip to content

Instantly share code, notes, and snippets.

Puppet::Parser::Functions::newfunction(
:fqdn_rand_base64,
:arity => -2,
:type => :rvalue,
:doc => "Usage: `fqdn_rand_base64(LENGTH, [SEED])`. LENGTH is required and
must be a positive integer; SEED is optional and may be any number or string.
Generates a random base64 string LENGTH characters long, combining the `$fqdn`
fact and the value of SEED for repeatable randomness. (That is, each node
will get a different random string from this function, but a given node's
@elyscape
elyscape / 1-hostfile
Created January 22, 2015 22:31
Puppet's flawed implementation of the host type
127.0.0.1 localhost.localdomain localhost.localdomain localhost4 localhost4.localdomain4 localhost puppet-eli
::1 localhost.localdomain localhost.localdomain localhost6 localhost6.localdomain6 localhost puppet-eli
def deep_upcase(item)
if item.respond_to? :upcase
return item.upcase
end
case item
when Array
item.map { |i| deep_upcase(i) }
when Hash
Hash[item.map { |k,v| [deep_upcase(k), deep_upcase(v)] } ]
else
@elyscape
elyscape / gist:da79269dd9d1a7f20ff7
Created March 6, 2015 21:03
r10k version --verbose
# 1.9.3 box
[root@puppet cli]# r10k version -v
r10k 1.4.0
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Command path: /usr/bin/r10k
Interpreter path: /opt/puppet/bin/ruby
System encoding: UTF-8
# 1.8.7 box
[root@puppet-eli cli]# r10k version --verbose
r10k 1.4.1
@elyscape
elyscape / remove_after.rb
Created May 28, 2015 19:38
lib/puppet/type/remove_after.rb
Puppet::Type.newtype(:remove_after) do
@doc = "Removes ensurable temporary resources once they have been used.
MORE HERE
"
newparam(:temp_resource) do
desc <<-'EOT'
The ensurable resource to remove. This can be specified as either a
resource reference or as a string in the form "Type[name]". Note that
@elyscape
elyscape / caway.scpt
Created June 1, 2015 18:59
Away for the current server
on textualcmd(inputString, destinationChannel)
return "/quote AWAY " & inputString
end textualcmd

Keybase proof

I hereby claim:

  • I am elyscape on github.
  • I am elyscape (https://keybase.io/elyscape) on keybase.
  • I have a public key ASAmHBIJKn9FV4J09TR4dusU8wQhlc7SPZYJ-lQ75bGmEwo

To claim this, I am signing this object:

@elyscape
elyscape / ses-credential-generator.rb
Last active June 21, 2016 16:24
This script converts an AWS secret access key into an SMTP password for SES.
#!/usr/bin/env ruby
require 'openssl'
require 'base64'
require 'io/console'
VERSION = "\x02".force_encoding('BINARY').freeze
MESSAGE = 'SendRawEmail'.freeze
digest = OpenSSL::Digest.new('sha256')
@elyscape
elyscape / Dockerfile
Last active May 17, 2017 20:18
These commands add Tini to a Docker image - https://github.com/krallin/tini
# Set TINI_ARCH to one of:
# ''
# amd64
# arm64
# armhf
# i386
# static
# static-amd64
# static-arm64
# static-armhf
@elyscape
elyscape / Dockerfile
Last active January 18, 2017 20:15
These commands add dumb-init to a Docker image - https://github.com/Yelp/dumb-init
RUN \
DUMB_INIT_VERSION=1.2.0 && \
DUMB_INIT_SHA256SUM=81231da1cd074fdc81af62789fead8641ef3f24b6b07366a1c34e5b059faf363 && \
curl -fsSLo /sbin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64" && \
echo "${DUMB_INIT_SHA256SUM} */sbin/dumb-init" | sha256sum -c - && \
chmod +x /sbin/dumb-init
ENTRYPOINT [ "/sbin/dumb-init", "--" ]