Skip to content

Instantly share code, notes, and snippets.

curl -k \
--key $(puppet config print hostprivkey) \
--cert $(puppet config print hostcert) \
--cacert $(puppet config print localcacert) \
--url https://$(puppet config print server):8140/puppet/v4/catalog \
-H 'Content-Type: application/json' \
-d @$1
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/util/symbolize_keys.rb:14:in `symbolize_keys!'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/settings/collection.rb:51:in `assign'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/settings/collection.rb:36:in `evaluate'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/action/runner.rb:66:in `setup_settings'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/action/runner.rb:30:in `call'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/r10k-3.1.1/lib/r10k/action/cri_runner.rb:67:in `call'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/cri-2.15.1/lib/cri/command_dsl.rb:303:in `block in runner'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/cri-2.15.1/lib/cri/command.rb:359:in `run_this'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/cri-2.15.1/lib/cri/command.rb:296:in `run'",
"/opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/cri-2.1
require 'date'
require 'pp'
pid = /^(\d+)\s*/
time = /\s*(\d{2}:\d{2}:\d{2}\.\d+)\s*/
scall = /\s*(\w+)\(/
rescall = /<\.\.\. (\w+) resumed/
status = /\s=\s(-?\d+)/
dur = /\s*<(\d+\.\d+)>/
fin_line = /#{pid}#{time}#{scall}.*#{status}.*#{dur}$/
#!/bin/bash
numProc=`cat /proc/cpuinfo | grep processor | wc -l`
megsMem=`cat /proc/meminfo | grep MemTotal | grep -Eo '[[:digit:]]+' | awk '{print int(($0 / 1000) +0.5)}'`
# JRuby 9k requires more space for codecaching
# and metaspace
if [[ $numProc -gt 6 ]]; then
codeCache=512
in master-service we call
master-core/construct-root-routes w/
puppet-version (string from config)
use-legacy-auth-conf (bool from config)
jruby-service (instance of JRubyService)
get-code-content (fn from VersionedCodeService)
get-code-id (fn from VersionCodeService)
handle-request (fn from RequestHandlerService)
environment-class-cache-enabled (bool from config)
# To be used within the Puppet::Server::Master initialize method
# Outpus to be used when calling find, save, etc on termini
# e.g.
#
# require 'puppet/indirector/indirection'
# require 'puppet/indirector/terminus'
# ...
#
# class Puppet::Server::Master
# ...
# to reliably reproduce run with: ruby repro.rb 10000
require 'fcntl'
class Pump
attr_reader :string
def initialize(io)
@io = io
@thread = nil
@string = ''
@run = true
require 'openssl'
PRIVATE_KEY_LENGTH = 2048
NOT_BEFORE = Time.now
NOT_AFTER = Time.now + (5 * 365 * 24 * 60 * 60)
CA_EXTENSIONS = [
["basicConstraints", "CA:TRUE", true],
["keyUsage", "keyCertSign, cRLSign", true],
["subjectKeyIdentifier", "hash", false],
["authorityKeyIdentifier", "keyid:always", false]
@justinstoller
justinstoller / encoding.md
Created March 19, 2018 18:32 — forked from Iristyle/encoding.md
Encoding in Puppet

Basic encoding info

  • ASCII is 0 - 7F (128 total characters) - ASCII is a subset of UTF-8
  • UTF-8 - variable width 1 to 4 bytes
Numberof bytes Bits forcode point Firstcode point Lastcode point Byte 1 Byte 2 Byte 3 Byte 4
1 7 U+0000 U+007F 0xxxxxxx      
2 11 U+0080 U+07FF 110xxxxx 10xxxxxx    
3 16 U+0800 U+FFFF 1110xxxx 10xxxxxx 10xxxxxx  
@justinstoller
justinstoller / summarize_sim.rb
Created March 19, 2018 16:41
summarize gatlins runs
#!/usr/bin/env ruby [23/9866]
require 'csv'
inputfile = ARGV[0]
intermediate = {
'node' => {'KOs' => 0, 'values' => [], 'ok' => 0},
'filemeta plugins' => {'KOs' => 0, 'values' => [], 'ok' => 0},
'filemeta pluginfacts' => {'KOs' => 0, 'values' => [], 'ok' => 0},
'catalog' => {'KOs' => 0, 'values' => [], 'ok' => 0},