Skip to content

Instantly share code, notes, and snippets.

View nicklewis's full-sized avatar

Nick Lewis nicklewis

View GitHub Profile
foo.example.com
bar.example.com
baz.example.com
FROM ubuntu:16.04
ARG vcs_ref
ARG build_date
ARG version="2019.0.1.8"
ENV PE_VERSION="2019.0"
ENV PEPER_VERSION="2019.0.2.1"
ENV JAVA_VERSION="2019.0.1.8.0.191"
ENV PUPPET_AGENT_VERSION="6.0.4"
ENV ORCHESTRATION_SERVICES_VERSION="$version"
@nicklewis
nicklewis / package_versions.pp
Last active September 6, 2018 01:27
A Bolt plan to show aggregated package versions, using only built-in content.
# Example:
# $ bolt plan run package_versions nodes=foo.example.com,bar.example.com,baz.example.com package=openssl
# Starting: plan package_versions
# Finished: plan package_versions in 7.62 sec
# {
# "1:1.0.2k-12.el7": [
# "foo.example.com",
# "bar.example.com"
# ],
# "1:1.0.2k-8.el7": [
@nicklewis
nicklewis / init.pp
Created March 28, 2018 17:56
recur module (PUP-8610)
plan recur() {
recur::recurf(0, 0)
}
@nicklewis
nicklewis / Dockerfile
Last active November 9, 2017 20:00
dockerfile for bolt
FROM alpine:latest
RUN apk --update add ruby ruby-json ruby-io-console openssh gcc ruby-dev make musl-dev libffi-dev curl tar
RUN gem install bolt --no-ri --no-rdoc
WORKDIR /var/lib/bolt
RUN mkdir package service
RUN curl -s https://forge.puppet.com/v3/files/puppetlabs-package-0.1.5.tar.gz | tar zxf - --strip-components=1 -C package --wildcards '*/tasks'
RUN curl -s https://forge.puppet.com/v3/files/puppetlabs-service-0.1.3.tar.gz | tar zxf - --strip-components=1 -C service --wildcards '*/tasks'
WITH inactive_nodes
AS (SELECT certname
FROM certnames
WHERE ( deactivated IS NOT NULL
OR expired IS NOT NULL ))
SELECT reports.certname AS certname,
Encode(reports.hash :: bytea, 'hex') AS hash,
reports.end_time AS end_time,
reports.noop AS noop,
report_statuses.status AS status,
@nicklewis
nicklewis / jira_epic_graph.rb
Created January 4, 2017 23:58
Generate a dot graph of the blocking relationships between all the tickets in a set of epics
#!/usr/bin/env ruby
require 'net/http'
require 'json'
raise "Specify at least one epic" if ARGV.empty?
def make_request(client, url)
request = Net::HTTP::Get.new(url)
request.basic_auth ENV['JIRA_USERNAME'], ENV['JIRA_PASSWORD']
@nicklewis
nicklewis / gist:d6a1988c0e651111b7dc
Created August 10, 2015 12:07
icfp 2015 power phrases
ei!
tsathoggua
r'lyeh
in his house at r'lyeh dead cthulhu waits dreaming.
ph'nglui mglw'nafh cthulhu r'lyeh wgah'nagl fhtagn.
yuggoth
yoyodyne
cthulhu fhtagn!
ia! ia!
yogsothoth
@nicklewis
nicklewis / gist:6515299
Created September 10, 2013 20:37
postgres relation sizes
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
@nicklewis
nicklewis / gist:6384464
Created August 29, 2013 23:01
Hypothetical PuppetDB ternary operator
["and",
["=", "type", "Package"],
["?:",
["in", "certname",
["extract", "certname",
["select-facts",
["and", ["=", "name", "kernelrelease"], ["=", "value", "3.2.0-3-amd64"]]]]]
["=", "title", "linux-headers-3.2.0-3-amd64"],
["=", "title", "linux-headers-3.2.0-2-amd64"]]]