Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Blesi pblesi

View GitHub Profile
@pblesi
pblesi / renew_ssl_certs.rb
Last active Nov 6, 2019
An example runbook that handles SSL cert rotation
View renew_ssl_certs.rb
#!/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"]
View blog_post_snippets_01_dominopeg_puzzle_solver.md
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 Feb 5, 2017
A solver for the dominopeg wood puzzle
View dominopeg_puzzle_solver.rb
#!/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]},