Skip to content

Instantly share code, notes, and snippets.

View pblesi's full-sized avatar

Patrick Blesi pblesi

View GitHub Profile
@pblesi
pblesi / renew_ssl_certs.rb
Last active November 6, 2019 04:39
An example runbook that handles SSL cert rotation
#!/usr/bin/env ruby
require "runbook"
host = ENV["HOST"] # e.x. ldap01.stg
raise "Error no host specified using HOST env var" unless host
service = ENV["SERVICE"] # e.x. slapd
raise "Error no service specified using SERVICE env var" unless service
local_user = ENV["USER"]
def _init_pieces
  pieces = []
  BasePieces.each do |base_piece|
    Flips.each do |flip|
      Orientations.each do |orientation|
        pieces << Piece.new(base_piece, flip, orientation)
      end
    end
  end
@pblesi
pblesi / dominopeg_puzzle_solver.rb
Last active February 5, 2017 20:46
A solver for the dominopeg wood puzzle
#!/usr/bin/env ruby
# Solves [dominopeg puzzle](http://www.puzzlemist.com/dominopeg.html)
BasePieces = [
{id: "0", spots: [0, 1]},
{id: "1", spots: [0, 2]},
{id: "2", spots: [0, 7]},
{id: "3", spots: [0, 8]},
{id: "4", spots: [0, 9]},