Skip to content

Instantly share code, notes, and snippets.

View big-samantha's full-sized avatar

Samantha Smith big-samantha

View GitHub Profile
class a {
notify { '1': }
notify { '2': }
notify { '3': }
}
class b {
Notify['3'] ->
class Klass
attr_reader :number
def initialize(number)
@number = number
end
end
# is the same as
class Klass
Start-Transcript -path C:\wilhelm\finalize_transcript.txt -Append -Force
$data = ConvertFrom-Json -InputObject(Get-Content 'C:\wilhelm\machine_data.json')
$da_user = $data.domain_admin_user
$da_pass = $data.domain_admin_pass | ConvertTo-SecureString -asPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($da_user,$da_pass)
#Create Credentials
# Set IP address and Subnet Mask
New-NetIPAddress -IPAddress $data.ip -AddressFamily IPv4 -InterfaceAlias Ethernet0 -PrefixLength $data.subnet_prefix -DefaultGateway $data.gateway
class Someclass
attr_accessor :param
def initialize(param_val=nil)
@param = param_val || 'reasonable default'
end
end
def networks
networks ||= self.datacenter.network.map do |dc_obj|
[dc_obj.name,dc_obj]
end.to_h
networks
end
define kerberos::setting (
$section,
$setting,
$value,
) {
augeas { "krb5.conf-${title}":
context => "/files/etc/krb5.conf/${section}",
changes => "set ${setting} ${value}",
}
}
$users = ['zee','paul','luke']
$users.each |$user| {
user { $user:
ensure => present,
}
file { "/home/${user}":
ensure => directory,
owner => $user,
$foo = nil
if $foo {
notify { 'foo has truthiness': }
}
else {
notify { 'foo has falsiness': }
}
require 'hiera'
module Wilhelm
class Config
class Hiera
attr_reader :configpath,:datadir,:hierarchy
def initialize(path)
@configpath = path
@hierarchy = hierarchy
end
@big-samantha
big-samantha / list.rb
Created February 18, 2016 22:53
requiring wilhelm/project/list returns "project is not a module" It's true, Project is a class. Is there some way to still handle the namespacing?
require 'yaml'
module Wilhelm
module Project
class List
attr_reader :projectfiles
def initialize(projectdir='/etc/wilhelm/data/projects')
@projectfiles = Dir["#{projectdir}/*"]