Skip to content

Instantly share code, notes, and snippets.

View Sharpie's full-sized avatar

Charlie Sharpsteen Sharpie

View GitHub Profile
@Sharpie
Sharpie / Puppetfile
Created March 9, 2016 23:58
App Orchestration Wordpress example
mod 'appmgmt_blog', git: 'https://github.com/ncorrare/ncorrare-appmgmt_blog'
mod 'hunner-hiera'
mod 'hunner-wordpress'
mod 'nanliu-staging'
mod 'puppetlabs-apache'
mod 'puppetlabs-concat'
mod 'puppetlabs-inifile'
mod 'puppetlabs-mysql'
mod 'puppetlabs-stdlib'
@Sharpie
Sharpie / version_info.pp
Created January 25, 2016 20:07
Puppet manifest version detection code
if versioncmp($::puppetversion, '4') > 0 {
notify {'Puppet 4.0.0 or newer': }
# Use AIO paths, puppet_gem and puppetserver_gem providers,
# multiple providers for a single package, etc.
} else {
case $::puppetversion {
/Puppet Enterprise/: {
notify {'PE 3.x': }
# Use PE paths, pe_gem and pe_puppetserver_gem providers.
}
@Sharpie
Sharpie / NOTES.md
Last active October 3, 2016 23:44
PE Debugging with Pry

This gist contains configuration to make Pry behave a bit better under Puppet Server JRuby.

For debugging, the following might be helpful:

  • Install the pry-nav gem. This is an oldschool "debugger" plugin for Pry and one of the first produced. Newer options like pry-debugger orpry-byebug are much, much better but are tightly integrated with CRuby. The pry-nav plugin provides "next", "step" and "continue" and is as dumb as a bag of hammers, but much better than nothing.

Outstanding issues:

  • Readline completion is busted under Puppet Server for some unknown reason. It works fine when running Pry under a normal JRuby shell. My guess is that some clojure bit is intercepting the tab characters.
@Sharpie
Sharpie / package-composite-key.patch
Last active August 29, 2015 14:07
Spike of a composite key for the Puppet Package type
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb
index 9a009db..4272bff 100644
--- a/lib/puppet/type/package.rb
+++ b/lib/puppet/type/package.rb
@@ -239,6 +239,37 @@ module Puppet
end
end
+ # We call providify here so that we can set provider as a namevar.
+ # Normally this method is called after newtype finishes constructing this
@Sharpie
Sharpie / doc-lint.rb
Last active August 29, 2015 14:00
A simple YARD linter that prints out the names of files with issues
#!/usr/bin/env ruby
require 'open3'
stdout, stderr, status = Open3.capture3 'inch'
lint = {}
FILE_REGEX = /\[debug\]: (Parsing|Re-processing) ([^[:blank:]]*\.rb)[\.]*$/
current_file = nil
stdout.each_line do |line|
@Sharpie
Sharpie / download_epa.js
Last active August 29, 2015 13:59
A Script to Download CSV Data from EPA ECHO
#!/usr/bin/env casperjs
'use strict';
// The sledgehammer approach: Use a JavaScript testing framework to simulate
// web browsing. Slow as all hell, but gets the job done.
//
// Caveat Utilitor: This was hacked together on a musky Portland afternoon
// under the influence of several cans of excellent Oakshire "Watershed" IPA.
//
// Installation
@Sharpie
Sharpie / show_whits.patch
Created April 9, 2014 17:56
Puppet Graphs: Show Whits
diff --git a/lib/puppet/graph/simple_graph.rb b/lib/puppet/graph/simple_graph.rb
index 57174ee..29820f6 100644
--- a/lib/puppet/graph/simple_graph.rb
+++ b/lib/puppet/graph/simple_graph.rb
@@ -435,19 +435,19 @@ class Puppet::Graph::SimpleGraph
graph = (directed? ? DOT::DOTDigraph : DOT::DOTSubgraph).new(params)
edge_klass = directed? ? DOT::DOTDirectedEdge : DOT::DOTEdge
vertices.each do |v|
- name = v.to_s
+ name = v.ref
mod 'filemapper', :git => 'https://github.com/adrienthebo/puppet-filemapper.git'
mod 'filemapper_cron', :git => 'https://github.com/Sharpie/puppet-filemapper_cron.git', :branch => 'repro-purging'
@Sharpie
Sharpie / README.md
Created January 20, 2014 05:16 — forked from mbostock/.block

The first 15 seconds of the D3 show reel. See full video at http://vimeo.com/29862153. Includes seamless transitions between the following visualization types:

  • lines
  • horizons
  • areas
  • stacked areas
  • streamgraph
  • overlapping areas
  • grouped bars
  • stacked bars
@Sharpie
Sharpie / Gemfile
Last active January 2, 2016 10:28
Use fpm-cookery to build packages with UTF-8 descriptions
source 'https://rubygems.org'
gem 'fpm'
gem 'fpm-cookery'