Skip to content

Instantly share code, notes, and snippets.

$h = {
"cat" => {
type => "feline",
colour => "black",
},
"dog" => {
type => "canine",
colour => "red",
},
"cow" => {
@robinbowes
robinbowes / gist:4718189
Last active December 12, 2015 04:58
Two of the file resources in this define throw errors if uncommented. "$sv_dir/log/config" and "$sv_dir/log/run"
define runit::service(
$svc_run_content = undef,
$svc_run_source = undef,
$svc_run_target = undef,
$svc_log_content = undef,
$svc_log_source = undef,
$sysconfig_content = undef,
$sysconfig_source = undef,
$sysconfig_log_content = undef,
$sysconfig_log_source = undef,
cert=<%= cert %>
key=<%= key %>
CApath=<%= capath %>
foreground=yes
debug=<%= debug %>
[<%= name %>]
accept=<%= accept %>
connect=<%= connect %>
client=<%= client %>
@robinbowes
robinbowes / gist:4753460
Created February 11, 2013 09:26
bonnie++ results from nas02 SunOS nas02 5.11 joyent_20130207T202554Z i86pc i386 i86pc
[root@nas02 ~]# bonnie++ -u 0 -r 16384 -s 400000 -n 256 -b -d /zones/bonnie++/
Using uid:0, gid:0.
Writing with putc()...done
Writing intelligently...done
Rewriting...done
Reading with getc()...done
Reading intelligently...done
start 'em...done...done...done...
Create files in sequential order...done.
Stat files in sequential order...done.
This data in hiera:
resources:
djbdns::dnscache:
dnscache-external:
if_name: 'bond0.12:dce'
listen_ip: 10.1.12.53
servers: undef
accept_ips:
- 10.
class ntp {
include
::ntp::user,
::ntp::install,
::ntp::config,
::ntp::service,
::ntp::firewall
Class[ '::ntp::user' ]->
Auto DoS
Enable - Select to prevent receiving packets from the all attacks mentioned below (Default: Disabled).
Prevent Land Attack - Prevents receiving packets with matching Source and Destination IP addresses.
Prevent TCP Blat Attack - TCP Source and Destination Port match
Prevent UDP Blat Attack - UDP Source and Destination Port match
Prevent Ping Of Death Attack - Prevents receiving ping packets with a size larger than 512 bytes through the use of fragments, which can target vulnerable systems.
Prevent Invalid TCP Flags Attack - Prevents receiving packets with invalid TCP flags. TCP Flag SYN set and Source Port less than 1024 or TCP Control Flags = 0 and TCP Sequence Number = 0 or TCP Flags FIN, URG, and PSH set and TCP Sequence Number = 0 or TCP Flags SYN and FIN set.
Prevent TCP Fragment Attack - Drop IP Packets that have a TCP header less than 20 bytes.
module Puppet::Parser::Functions
newfunction(:hiera_resources, :type => :statement) do |args|
raise Puppet::Error, "hiera_resources requires 1 argument; got #{args.length}" if args.length != 1
res_name = args[0][0]
apps = function_hiera_hash([res_name, {}])
apps.each { | res_type, res_params | function_create_resources([res_type, res_params]) }
end
end
@robinbowes
robinbowes / gist:5579228
Created May 14, 2013 20:25
Output from gem list after installing fpm-create rubygem-capistrano
WARNING: #<NoMethodError: undefined method `licenses=' for #<Gem::Specification:0x2b670333c5d0>>
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{net-scp}
s.version = "1.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jamis Buck", "Delano Mandelbaum"]
s.cert_chain = ["-----BEGIN CERTIFICATE-----\nMIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZkZWxh\nbm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj\nb20wHhcNMTMwMjA2MTE1NzQ1WhcNMTQwMjA2MTE1NzQ1WjBBMQ8wDQYDVQQDDAZk\nZWxhbm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ\nFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDg1hMtl0XsMuUK\nAKTgYWv3gjj7vuEsE2EjT+vyBg8/LpqVVwZziiaebJT9IZiQ+sCFqbiakj0b53pI\nhg1yOaBEmH6/W0L7rwzqaRV9sW1eJs9JxFYQCnd67zUnzj8nnRlOjG+hhIG+Vsij\nnpsGbt28pefuNZJjO5q2clAlfSniIIHfIsU7/StEYu6FUGOjnwryZ0r5yJlr9RrE\nGs+q0DW8QnZ9UpAfuDFQZuIqeKQFFLE7nMmCGaA+0BN1nLl3fVHNbLHq7Avk8+Z+\nZuuvkdscbHlO/l+3xCNQ5nUnH
@robinbowes
robinbowes / gist:5637643
Created May 23, 2013 17:03
Shell script to implement the set intersection operation.
#!/bin/bash
datadir="$1"
set_list=$(ls -1 "$datadir")
first_set=$(echo $set_list | awk '{print $1;}')
for set in $set_list; do
if [ $set == $first_set ]; then
result=$(sort "$datadir/$set")
else