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
# Apple Binary Property List serializer for Ruby 1.8.
require 'iconv'
module AppleBinaryPropertyList
MIME_TYPE = 'application/octet-stream' # Don't know what to use, so use a very generic type for now
CFData = Struct.new(:data) # For marking strings as binary data which will be decoded as a CFData object
vhost { 'dashboard': ensure => present }
Package <| name == 'passenger' |> -> Vhost['dashboard']
@nanliu
nanliu / gist:1353458
Created November 9, 2011 23:01
Puppet Manifest Cleanup
#!/usr/bin/ruby
require 'parser-emit'
class Puppet::Parser::AST::Definition
attr_accessor :name
end
class Manifest
class << self
#include Enumerable
#!/usr/bin/env ruby
require 'rubygems'
require 'digest/sha2'
require 'cfpropertylist'
def salted_sha512(password)
seedint = rand(((2**31 - 1)-1+1))
seedhex = ("%x" % seedint).upcase.rjust(8, '0')
seedstring = seedint.to_a.pack("L")
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

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
@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:
@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}"],
@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
@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