Skip to content

Instantly share code, notes, and snippets.

@MattMencel
MattMencel / zimbra-soap.txt
Created June 7, 2010 17:37
Zimbra 6.0.4 soap.txt file from docs
REST URL for requesting content:
http://server/service/home/[˜][{username}]/[{folder}]?[{query-params}]
fmt={ics, csv, etc}
id={item-id}
imap_id={item-imap-id}
part={mime-part}
query={search-query}
types={types} // when searching
auth={auth-types}
@MattMencel
MattMencel / reset_vm_nic.rb
Created December 7, 2012 19:15
Reset VM Network Adapter After Clone - Fix "Connect at power on" Bug
require 'rubygmes'
require 'rbvmomi'
vim = RbVmomi::VIM.connect host: vcenter_host_name, user: vcenter_user, password: vcenter_password, :insecure => true
dc = vim.serviceInstance.find_datacenter(my_datacenter) or fail "datacenter not found"
vm = dc.find_vm("folder_path_to_vm) or fail "VM not found"
dnic = vm.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).find{|nic| nic.props}
port = dnic[:backing][:port]
@MattMencel
MattMencel / bootstrap_vm_from_template.rb
Last active December 15, 2015 18:19
This is a site specific script I use to bootstrap VMware templates using Chef, the knife-vsphere gem, and rbvmomi gem. It needs lots of work to make it less site specific, but shows how knife-vsphere and rbvmomi can be used to do some cool stuff.
#!/usr/bin/env ruby
# PREREQ: YOU MUST HAVE A TEMPLATE ALREADY BUILT. IF USING UBUNTU,
# MAKE SURE THE LAST STEP BEFORE YOU CREATE THE TEMPLATE IS THIS OR THE NETWORKING STEPS WON'T WORK.
# http://chris.dziemborowicz.com/blog/2010/07/25/fix-missing-eth0-when-cloning-ubuntu-vmware-virtual-machines/
require 'rubygems'
require 'awesome_print'
require 'net/ping'
require 'rbvmomi'
---
description: Limited RUN access to Web Services Group
context:
project: 'Support'
for:
event:
- equals:
group: 'Web Services'
name: 'Restart OCE'
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/wiu-base/recipes/default.rb
================================================================================
RuntimeError
------------
Unknown package type encountered for install:
Cookbook Trace:
---------------
describe 'my_rancher::default' do
context 'When all attributes are default, on an unspecified platform' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(described_recipe)
end
# it 'converges successfully' do
# expect(chef_run).to_not raise_error
# end
@MattMencel
MattMencel / gitlabrunner.yaml
Last active October 27, 2016 14:52
configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: gitlab-runner
namespace: gitlab
data:
config-toml: |
concurrent = 4
[[runners]]
@MattMencel
MattMencel / pi_chef-client_omnibus.rb
Last active November 17, 2016 15:44
Upgrade Chef Client with Omnibus_Updater Cookbook on Raspberry Pi
# base chef-client has already been installed via package mgmt or git
package 'libgmp3-dev' do
# required for libyajl gem which is required for chef gem
action :upgrade
end
# Pull chef repo so we can build the omnibus packages
git '/usr/local/src/chef' do
@MattMencel
MattMencel / metadata.rb
Last active November 22, 2016 22:09
Get SPF Info From Google
require 'spf/query'
# regular metadata stuff below
@MattMencel
MattMencel / smsd.rb
Created December 20, 2016 19:15
SMS Modem Cookbook
%w(
build-essential
libusb-1.0
libusb-1.0-0-dev
modemmanager
smstools
tcl
).each do |pkg|
package pkg do
action :install