Skip to content

Instantly share code, notes, and snippets.

@rubiojr
rubiojr / rbvmomi_example1.rb
Created September 5, 2011 15:28
Ruby VMWare VSphere API Example 1 (rbvmomi)
require 'rubygems'
require 'rbvmomi'
require 'pp'
require 'alchemist'
hyper = 'thunder03'
vim = RbVmomi::VIM.connect :host => hyper, :user => 'root', :password => 'secret', :insecure => true
#
# get current time
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@turtlebender
turtlebender / bootstrap.py
Created December 5, 2012 19:03
Bootstrap chef in Autoscaling Group
#!/usr/bin/env python
"""
This module will bootstrap a machine using chef. The purpose of this
script is actually to work with AWS Auto Scaling Groups. The user data
for the Launch Configuration is set to download this script and then
run it. This is also stores the results in a private gist and sends
a message to logstash with the results.
"""
@arangamani
arangamani / chef_attribute_converge.rb
Last active February 20, 2023 02:44
Dynamically update attribute of a Chef resource during converge phase (Node variable assignment in Compile vs Converge)
# In Chef, when a resource is defined all its variables are evaluated during
# compile time and the execution of the resource takes place in converge phase.
# So if the value of a particular attribute is changed in converge
# (and not in compile) the resource will be executed with the old value.
# Example problem:
# Let's consider this situation where there are two steps involved in a recipe
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed
# in converge phase
# Step 2 is a Chef resource that makes use of the node attribute that was
@JC1738
JC1738 / Invoke chef run on windows by Role.ps1
Last active March 31, 2017 02:56
Use Node Search and Powershell to invoke a chef run by role
#powershell
Set-Location c:\chef
#debugging, set to false, so don't execute run
$invokeRun = $true
#update these with teamcity parameters
$userName = "XXXXX"
$password = "XXXXX"
@ipedrazas
ipedrazas / knife cheat
Last active December 13, 2021 11:50
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@jmahowald
jmahowald / gist:b5d96d53a1a40a3ebd72
Created March 26, 2015 22:35
thor actions to help with kitchen reloads
require 'thor'
require 'fileutils'
require 'yaml'
##
# common commands used to manage berks in a way that makes sense for that
# Inspired by the fact that berks is a great idea that is painfully slow
# when using mercurial, and thus needs to work around the prescribed workflow
@rossf7
rossf7 / production.yml
Created May 26, 2015 11:29
force12-ecs-launch-config
#cloud-config
coreos:
units:
-
name: amazon-ecs-agent.service
command: start
runtime: true
content: |
[Unit]
@yyolk
yyolk / sample_sns_event.json
Created October 30, 2015 20:52
AWS Lambda SNS Sample Event
{
"Records": [
{
"EventVersion": "1.0",
"EventSubscriptionArn": "arn:aws:sns:EXAMPLE",
"EventSource": "aws:sns",
"Sns": {
"SignatureVersion": "1",
"Timestamp": "1970-01-01T00:00:00.000Z",
"Signature": "EXAMPLE",
@so0k
so0k / kubectl.md
Last active April 25, 2024 12:40
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no