Skip to content

Instantly share code, notes, and snippets.

@natemccurdy
natemccurdy / clear-jruby-pools.sh
Last active May 13, 2016 00:25
Clear the jruby pools in puppetserver
#!/bin/bash
# GIST_URL: https://gist.github.com/natemccurdy/13e3b2d8477dbd6bd01d
# Run this on a puppetserver to delete its JRuby pools to clear their cache.
# A response of "HTTP/1.1 204 No Content" means it worked.
#
# https://docs.puppetlabs.com/puppetserver/latest/admin-api/v1/jruby-pool.html
CONFDIR="$(puppet master --configprint confdir)"
CERT="$(puppet master --confdir "${CONFDIR}" --configprint hostcert)"
require 'webrick'
require 'json'
include WEBrick
def start_webrick(config = {})
config.update(:Port => 9001)
server = HTTPServer.new(config)
yield server if block_given?
['INT', 'TERM'].each {|signal|
@op-ct
op-ct / catalog_dump_from_spec_test.rb
Last active January 13, 2016 10:04 — forked from spiette/gist:5280394
Dumping the catalog from within a Puppet spec test
# WARNING: massive screen scroll
$stdout.puts self.catalogue.to_yaml
# Save to file
File.open( '_catalog.yaml', 'w'){ |f| f.puts self.catalogue.to_yaml }
legacy_opts = {
:default_action => 'gem_install',
:version => (ENV['PUPPET_VERSION'] || '3.8.1'),
}
aio_opts = {
:default_action => 'gem_install',
:version => (ENV['PUPPET_AGENT_VERSION'] || '1.1.0'),
}
@mbbx6spp
mbbx6spp / README.md
Last active January 8, 2025 13:23
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
@adamjmurray
adamjmurray / gist:3154437
Created July 21, 2012 03:18
Managing Ruby gems programmatically
# Environment, set GEM_HOME & GEM_PATH. For example, we can launch JRuby like this:
# GEM_HOME=/Users/amurray/tmp/gems/ GEM_PATH=/Users/amurray/tmp/gems java -jar ~/Downloads/jruby-complete-1.7.0.preview1.jar -S irb
# =====================
# LISTING gems
puts Gem::Specification.find_all.to_s
puts Gem::Specification.find_all.map{|spec| "#{spec.name} (#{spec.version})" }
# =====================
# USING (a specific version of) gems