Skip to content

Instantly share code, notes, and snippets.

View glarizza's full-sized avatar

Gary Larizza glarizza

  • Open Infrastructure Services
  • Portland, Oregon
View GitHub Profile
@brettswift
brettswift / pe_migration_3-3_to_3-8.sh
Created June 11, 2015 14:08
Puppet cert migration from 3.3 to 3.8
#Note: those with a gap between, run them individually (ie you may not want to copy multiple lines if there are spaces. Prompts will prevent subsequent lines from being pasted)
#Part 1 - Allow remote ssh commands to old puppet master
# comment out "Defaults requiretty" in /etc/sudoers on the 'old' puppet master to enable remote scripting. :)
#Part 2 follow this walkthrough: http://docs.puppetlabs.com/pe/latest/trouble_regenerate_certs_monolithic.html
#Walkthrough Step 1: Shut down all PE-related services
puppet resource service pe-puppet ensure=stopped
puppet resource service pe-puppetserver ensure=stopped
@reidmv
reidmv / gist:7808210
Last active December 30, 2015 09:19
Copy PE MCollective Master Certs
#!/bin/sh
# Assumptions: the new master system is called "remotehost.tld"
rsync -PHa --files-from - /etc/puppetlabs/ remotehost.tld:/etc/puppetlabs/ <<EOF
puppet/ssl/certs/pe-internal-broker.pem
puppet/ssl/certs/pe-internal-mcollective-servers.pem
puppet/ssl/certs/pe-internal-peadmin-mcollective-client.pem
puppet/ssl/certs/pe-internal-puppet-console-mcollective-client.pem
puppet/ssl/private_keys/pe-internal-broker.pem
@gnarf
gnarf / ..git-pr.md
Last active April 12, 2024 22:00
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@reidmv
reidmv / lib-facter-local_users.rb
Created October 29, 2012 16:55
Custom fact local_users in hypothetical "user" module
# This custom fact pulls out all local users from the /etc/passwd file
# and returns the collection as a comma-separated list.
Facter.add(:local_users) do
setcode do
users = Array.new
File.open("/etc/passwd").each do |line|
next if line.match(/^\s|^#|^$/)
users << line.split(':').first
end
@dayglojesus
dayglojesus / password.rb
Created August 4, 2012 17:41
Password class for DSLocalRrecord
require 'pp'
require 'osx/cocoa'
include OSX
class DSLocalPassword
attr_reader :content
@@macosx_major_version = 10.7
@@password_create_methods = {
@jeffmccune
jeffmccune / ruby_toolchain_10_8.markdown
Created July 30, 2012 20:56
Ruby Toolchain on Mac OS X Mountain Lion (10.8)

Overview

The intention is to get a clean build of MRI 1.8.7 and 1.9.3.

MRI 1.8.7 doesn't play nicely with LLVM based GCC compilers. In Mountain Lion, the only way to get a non-LLVM gcc is to build one yourself. The command line tools package in Xcode 4.4 does not contain a non-llvm based GCC.

Checklist

  1. Upgrade to Mountain Lion
  2. Remove all previous copies of Xcode
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 29, 2024 16:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@rtyler
rtyler / install.pp
Created May 8, 2012 16:34
Installs rvm for a specific user
define rvm::install() {
exec {
"download rvm for ${name}" :
creates => "/home/${name}/.rvm/scripts/rvm",
cwd => "/home/${name}",
command => 'curl -L get.rvm.io -o install-rvm.sh',
user => $name,
path => ['/bin', '/usr/bin'],
notify => Exec["install rvm for ${name}"],
@mattetti
mattetti / url_to_jpg.rb
Created April 25, 2012 15:24
MacRuby script to grab an url and save it as a jpg
#!/usr/local/bin/macruby
# Copyright (c) 2009 Matt Aimonetti
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
Facter.add(:noop) do
confine :kernel => :linux
result = false
setcode do
unless Facter.value(:environment).match(/^(test|dev|qa)$/)
result = true unless Time.now.utc.hour.between?(1, 10)
end