apt-get install kcachegrind
Create a sandbox folder and install Chef and rubyprof there with bundler
require 'chef' | |
Chef::Config.from_file('knife.rb') | |
envs = Chef::Environment.list.keys | |
q = Chef::Search::Query.new | |
envs.each do |e| | |
constrained_cookbooks = Chef::Environment.load(e).cookbook_versions.keys | |
all_cookbooks =[] | |
nodes = q.search(:node, "chef_environment:#{e}").first.reject(&:nil?) | |
nodes.select{|n| n.attribute?(:recipes)}.each do |n| | |
n.recipes.map{|r| r.split('::')[0]}.each do |cookbook| |
# located at chef_repo/environments/org1-prod.rb | |
require 'deep_merge' | |
name 'org1-prod' | |
description 'Production environment for org1' | |
org1_yml_path = File.expand_path('../common/org1.yml', __FILE__) | |
common = YAML.load_file(org1_yml_path) | |
default_attributes( | |
common['default'].deep_merge!( | |
# declare all you org1-prod specific things here. |
package main | |
import ( | |
"fmt" | |
"github.com/boltdb/bolt" | |
"os" | |
"time" | |
) | |
const bucket = "timers" |
Received: by 10.194.72.228 with SMTP id g4csp30259wjv; | |
Tue, 30 Aug 2016 13:32:34 -0700 (PDT) | |
X-Received: by 10.202.245.88 with SMTP id t85mr5521820oih.202.1472589154488; | |
Tue, 30 Aug 2016 13:32:34 -0700 (PDT) | |
Return-Path: <johnc.tyus@outlook.com> | |
Received: from SNT004-OMC1S9.hotmail.com (snt004-omc1s9.hotmail.com. [65.55.90.20]) | |
by mx.google.com with ESMTPS id o41si11702005oto.113.2016.08.30.13.32.34 | |
for <ranjib@pagerduty.com> | |
(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); |
import( | |
"github.com/docker/engine-api/client" | |
"github.com/docker/engine-api/types" | |
) | |
func Squash() { | |
defaultHeaders := map[string]string{"User-Agent": "abc-1.0"} | |
cli, _ := client.NewClient("unix:///var/run/docker.sock", "v1.22", nil, defaultHeaders) | |
ctx := context.Background() | |
saveBody, _ := cli.ImageSave(ctx, []string{"image-id"}) | |
src := types.ImageImportSource{ |
FROM ubuntu | |
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get install -y x11vnc xvfb firefox | |
RUN mkdir /home/ubuntu/.vnc | |
RUN x11vnc -storepasswd 1234 /home/ubuntu/.vnc/passwd | |
RUN bash -c 'echo "firefox" >> /home/ubuntu/.bashrc' |
c = LXC::Container.new('foo') | |
c.create('ubuntu') | |
c.start | |
# we'll start tripping from here | |
reader, writer = IO.pipe | |
c.attach(wait: true) do | |
reader.close # its a process clone, so you have all the variable | |
x = Dir['/*'] | |
writer.write(Marshal.dump(x)) |
name 'chef' | |
from 'ubuntu' | |
run 'apt-get install curl -y' | |
run 'curl -L https://www.opscode.com/chef/install.sh | sudo bash' |
execute "apt_update" do | |
command "apt-get update -y" | |
end | |
%w{ ack-grep autoconf automake autotools-dev binutils bridge-utils | |
build-essential coreutils debootstrap dnsmasq-base doxygen fakeroot | |
git gnutls-bin golang golang-src htop iproute2 libdevmapper-dev | |
libgnutls-dev libgnutls26 make ncurses-base ncurses-bin ncurses-term libssl-dev | |
openssl python3.3 python3.3-dev strace tcpdump telnet tmux vim wget zlib1g | |
zlib1g-dev python3-software-properties}.each do |pkg| |